NOISSUE improve toolbars

This commit is contained in:
Petr Mrázek
2019-07-23 00:48:14 +02:00
parent 1e5b595923
commit bf38021937
15 changed files with 138 additions and 42 deletions

View File

@ -17,6 +17,7 @@
#include "ui_AccountListPage.h"
#include <QItemSelectionModel>
#include <QMenu>
#include <QDebug>
@ -77,6 +78,14 @@ void AccountListPage::changeEvent(QEvent* event)
QMainWindow::changeEvent(event);
}
QMenu * AccountListPage::createPopupMenu()
{
QMenu* filteredMenu = QMainWindow::createPopupMenu();
filteredMenu->removeAction(ui->toolBar->toggleViewAction() );
return filteredMenu;
}
void AccountListPage::listChanged()
{
updateButtonStates();

View File

@ -61,6 +61,7 @@ public:
private:
void changeEvent(QEvent * event) override;
QMenu * createPopupMenu() override;
public
slots:

View File

@ -32,22 +32,10 @@
</item>
</layout>
</widget>
<widget class="QToolBar" name="toolBar">
<widget class="WideBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<property name="movable">
<bool>true</bool>
</property>
<property name="allowedAreas">
<set>Qt::LeftToolBarArea|Qt::RightToolBarArea</set>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
</property>
<property name="floatable">
<bool>false</bool>
</property>
<attribute name="toolBarArea">
<enum>RightToolBarArea</enum>
</attribute>
@ -95,6 +83,11 @@
<extends>QTreeView</extends>
<header>widgets/VersionListView.h</header>
</customwidget>
<customwidget>
<class>WideBar</class>
<extends>QToolBar</extends>
<header>widgets/WideBar.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>

View File

@ -38,11 +38,7 @@ ModFolderPage::ModFolderPage(BaseInstance *inst, std::shared_ptr<SimpleModList>
: QMainWindow(parent), ui(new Ui::ModFolderPage)
{
ui->setupUi(this);
QWidget* spacer = new QWidget();
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// toolBar is a pointer to an existing toolbar
ui->actionsToolbar->insertWidget(ui->actionView_configs, spacer);
ui->actionsToolbar->insertSpacer(ui->actionView_configs);
m_inst = inst;
on_RunningState_changed(m_inst && m_inst->isRunning());

View File

@ -73,19 +73,13 @@
</item>
</layout>
</widget>
<widget class="QToolBar" name="actionsToolbar">
<widget class="WideBar" name="actionsToolbar">
<property name="windowTitle">
<string>Actions</string>
</property>
<property name="allowedAreas">
<set>Qt::LeftToolBarArea|Qt::RightToolBarArea</set>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
</property>
<property name="floatable">
<bool>false</bool>
</property>
<attribute name="toolBarArea">
<enum>RightToolBarArea</enum>
</attribute>
@ -145,6 +139,11 @@
<header>widgets/MCModInfoFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>WideBar</class>
<extends>QToolBar</extends>
<header>widgets/WideBar.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>

View File

@ -223,11 +223,7 @@ ScreenshotsPage::ScreenshotsPage(QString path, QWidget *parent)
m_valid = FS::ensureFolderPathExists(m_folder);
ui->setupUi(this);
QWidget* spacer = new QWidget();
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// toolBar is a pointer to an existing toolbar
ui->toolBar->insertWidget(ui->actionView_Folder, spacer);
ui->toolBar->insertSpacer(ui->actionView_Folder);
ui->listView->setIconSize(QSize(128, 128));
ui->listView->setGridSize(QSize(192, 160));

View File

@ -39,10 +39,13 @@
</item>
</layout>
</widget>
<widget class="QToolBar" name="toolBar">
<widget class="WideBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
</property>
<attribute name="toolBarArea">
<enum>RightToolBarArea</enum>
</attribute>
@ -75,6 +78,13 @@
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>WideBar</class>
<extends>QToolBar</extends>
<header>widgets/WideBar.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -128,7 +128,7 @@
</item>
</layout>
</widget>
<widget class="QToolBar" name="toolBar">
<widget class="WideBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
@ -173,6 +173,13 @@
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>WideBar</class>
<extends>QToolBar</extends>
<header>widgets/WideBar.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>serversView</tabstop>
<tabstop>nameLine</tabstop>

View File

@ -112,10 +112,7 @@ VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent)
{
ui->setupUi(this);
QWidget* spacer = new QWidget();
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// toolBar is a pointer to an existing toolbar
ui->toolBar->insertWidget(ui->actionReload, spacer);
ui->toolBar->insertSpacer(ui->actionReload);
m_profile = m_inst->getComponentList();

View File

@ -62,7 +62,7 @@
</item>
</layout>
</widget>
<widget class="QToolBar" name="toolBar">
<widget class="WideBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
@ -239,6 +239,11 @@
<header>widgets/MCModInfoFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>WideBar</class>
<extends>QToolBar</extends>
<header>widgets/WideBar.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>

View File

@ -37,10 +37,7 @@ WorldListPage::WorldListPage(BaseInstance *inst, std::shared_ptr<WorldList> worl
{
ui->setupUi(this);
QWidget* spacer = new QWidget();
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// toolBar is a pointer to an existing toolbar
ui->toolBar->insertWidget(ui->actionRefresh, spacer);
ui->toolBar->insertSpacer(ui->actionRefresh);
QSortFilterProxyModel * proxy = new QSortFilterProxyModel(this);
proxy->setSortCaseSensitivity(Qt::CaseInsensitive);

View File

@ -57,7 +57,7 @@
</item>
</layout>
</widget>
<widget class="QToolBar" name="toolBar">
<widget class="WideBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
@ -128,6 +128,13 @@
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>WideBar</class>
<extends>QToolBar</extends>
<header>widgets/WideBar.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>