ui: on windows, use native menus
Minor UI improvement for Windows users.
This commit is contained in:
@@ -40,6 +40,15 @@ QList<StyleDescriptor> StyleManager::ListInternal()
|
||||
return style_list;
|
||||
}
|
||||
|
||||
void StyleManager::UseNativeWindowsStyling(QWidget *widget)
|
||||
{
|
||||
#ifdef Q_OS_WINDOWS
|
||||
QStyle* s = QStyleFactory::create(QStringLiteral("windowsvista"));
|
||||
widget->setStyle(s);
|
||||
widget->setPalette(s->standardPalette());
|
||||
#endif
|
||||
}
|
||||
|
||||
QPalette StyleManager::ParsePalette(const QString& ini_path)
|
||||
{
|
||||
QSettings ini(ini_path, QSettings::IniFormat);
|
||||
|
||||
@@ -48,6 +48,8 @@ public:
|
||||
|
||||
static QList<StyleDescriptor> ListInternal();
|
||||
|
||||
static void UseNativeWindowsStyling(QWidget* widget);
|
||||
|
||||
private:
|
||||
static QPalette ParsePalette(const QString& ini_path);
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
#include <QMenu>
|
||||
|
||||
#include "ui/icons/icons.h"
|
||||
#include "widget/menu/menu.h"
|
||||
|
||||
FootageComboBox::FootageComboBox(QWidget *parent) :
|
||||
QComboBox(parent),
|
||||
@@ -20,7 +20,7 @@ void FootageComboBox::showPopup()
|
||||
return;
|
||||
}
|
||||
|
||||
QMenu menu;
|
||||
Menu menu;
|
||||
|
||||
menu.setMinimumWidth(width());
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
Menu::Menu(QMenuBar *bar, const QObject* receiver, const char* member) :
|
||||
QMenu(bar)
|
||||
{
|
||||
StyleManager::UseNativeWindowsStyling(this);
|
||||
|
||||
bar->addMenu(this);
|
||||
|
||||
if (receiver != nullptr) {
|
||||
@@ -35,6 +37,8 @@ Menu::Menu(QMenuBar *bar, const QObject* receiver, const char* member) :
|
||||
Menu::Menu(Menu *menu, const QObject *receiver, const char *member) :
|
||||
QMenu(menu)
|
||||
{
|
||||
StyleManager::UseNativeWindowsStyling(this);
|
||||
|
||||
menu->addMenu(this);
|
||||
|
||||
if (receiver != nullptr) {
|
||||
@@ -45,11 +49,13 @@ Menu::Menu(Menu *menu, const QObject *receiver, const char *member) :
|
||||
Menu::Menu(QWidget *parent) :
|
||||
QMenu(parent)
|
||||
{
|
||||
StyleManager::UseNativeWindowsStyling(this);
|
||||
}
|
||||
|
||||
Menu::Menu(const QString &s, QWidget *parent) :
|
||||
QMenu(s, parent)
|
||||
{
|
||||
StyleManager::UseNativeWindowsStyling(this);
|
||||
}
|
||||
|
||||
QAction *Menu::AddItem(const QString &id,
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <QDebug>
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
#include <QMenu>
|
||||
#include <QProcess>
|
||||
#include <QUrl>
|
||||
#include <QVBoxLayout>
|
||||
@@ -32,6 +31,7 @@
|
||||
#include "core.h"
|
||||
#include "dialog/footageproperties/footageproperties.h"
|
||||
#include "dialog/sequence/sequence.h"
|
||||
#include "widget/menu/menu.h"
|
||||
|
||||
ProjectExplorer::ProjectExplorer(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@@ -231,7 +231,7 @@ void ProjectExplorer::RenameTimerSlot()
|
||||
|
||||
void ProjectExplorer::ShowContextMenu()
|
||||
{
|
||||
QMenu menu;
|
||||
Menu menu;
|
||||
|
||||
// FIXME: Support for multiple items and items other than Footage
|
||||
QList<Item*> selected_items = SelectedItems();
|
||||
|
||||
@@ -167,7 +167,7 @@ void Toolbar::SnappingButtonClicked(bool b)
|
||||
|
||||
void Toolbar::AddButtonClicked()
|
||||
{
|
||||
QMenu m(this);
|
||||
Menu m(this);
|
||||
|
||||
for (int i=0;i<Tool::kAddableCount;i++) {
|
||||
QAction* action = m.addAction(Tool::GetAddableObjectName(static_cast<Tool::AddableObject>(i)));
|
||||
|
||||
@@ -455,7 +455,7 @@ void ViewerWidget::UpdateRendererParameters()
|
||||
|
||||
void ViewerWidget::ShowContextMenu(const QPoint &pos)
|
||||
{
|
||||
QMenu menu(static_cast<QWidget*>(sender()));
|
||||
Menu menu(static_cast<QWidget*>(sender()));
|
||||
|
||||
context_menu_widget_ = static_cast<ViewerGLWidget*>(sender());
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "mainmenu.h"
|
||||
|
||||
#include <QEvent>
|
||||
#include <QStyleFactory>
|
||||
|
||||
#include "common/timecodefunctions.h"
|
||||
#include "core.h"
|
||||
@@ -35,6 +36,8 @@
|
||||
MainMenu::MainMenu(QMainWindow *parent) :
|
||||
QMenuBar(parent)
|
||||
{
|
||||
StyleManager::UseNativeWindowsStyling(this);
|
||||
|
||||
//
|
||||
// FILE MENU
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user