chore: use QToolButton instead of QPushButton for bottom bar
This commit is contained in:
@ -4,11 +4,21 @@
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
#define CREATE_NEW_ACTION(window, action)\
|
||||
action = new QAction(window);\
|
||||
#define ICON_NAME(name)\
|
||||
QStringLiteral(":/icons/" #name "")
|
||||
|
||||
#define SETUP_NEW_ACTION(window, action)\
|
||||
action->setObjectName(QString::fromUtf8( #action ));\
|
||||
window->addAction(action);
|
||||
|
||||
#define CREATE_NEW_ACTION(window, action)\
|
||||
action = new QAction(window);\
|
||||
SETUP_NEW_ACTION(window, action)
|
||||
|
||||
#define CREATE_NEW_ICON_ACTION(window, action, iconname)\
|
||||
action = new QAction(QIcon(ICON_NAME(iconname)), QString(), window);\
|
||||
SETUP_NEW_ACTION(window, action)
|
||||
|
||||
ActionManager::ActionManager()
|
||||
{
|
||||
|
||||
@ -21,15 +31,19 @@ ActionManager::~ActionManager()
|
||||
|
||||
void ActionManager::setupAction(MainWindow *mainWindow)
|
||||
{
|
||||
CREATE_NEW_ACTION(mainWindow, actionZoomIn);
|
||||
CREATE_NEW_ACTION(mainWindow, actionZoomOut);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionActualSize, zoom-original);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionToggleMaximize, view-fullscreen);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionZoomIn, zoom-in);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionZoomOut, zoom-out);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionToggleCheckerboard, view-background-checkerboard);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionRotateClockwise, object-rotate-right);
|
||||
|
||||
CREATE_NEW_ACTION(mainWindow, actionHorizontalFlip);
|
||||
CREATE_NEW_ACTION(mainWindow, actionFitInView);
|
||||
CREATE_NEW_ACTION(mainWindow, actionFitByWidth);
|
||||
CREATE_NEW_ACTION(mainWindow, actionCopyPixmap);
|
||||
CREATE_NEW_ACTION(mainWindow, actionCopyFilePath);
|
||||
CREATE_NEW_ACTION(mainWindow, actionPaste);
|
||||
CREATE_NEW_ACTION(mainWindow, actionToggleCheckerboard);
|
||||
CREATE_NEW_ACTION(mainWindow, actionToggleStayOnTop);
|
||||
CREATE_NEW_ACTION(mainWindow, actionToggleProtectMode);
|
||||
CREATE_NEW_ACTION(mainWindow, actionSettings);
|
||||
@ -46,15 +60,19 @@ void ActionManager::retranslateUi(MainWindow *mainWindow)
|
||||
{
|
||||
Q_UNUSED(mainWindow);
|
||||
|
||||
actionActualSize->setText(QCoreApplication::translate("MainWindow", "Actual size", nullptr));
|
||||
actionToggleMaximize->setText(QCoreApplication::translate("MainWindow", "Toggle maximize", nullptr));
|
||||
actionZoomIn->setText(QCoreApplication::translate("MainWindow", "Zoom in", nullptr));
|
||||
actionZoomOut->setText(QCoreApplication::translate("MainWindow", "Zoom out", nullptr));
|
||||
actionToggleCheckerboard->setText(QCoreApplication::translate("MainWindow", "Toggle Checkerboard", nullptr));
|
||||
actionRotateClockwise->setText(QCoreApplication::translate("MainWindow", "Rotate right", nullptr));
|
||||
|
||||
actionHorizontalFlip->setText(QCoreApplication::translate("MainWindow", "Flip &Horizontally", nullptr));
|
||||
actionFitInView->setText("Fit in view"); // TODO: what should it called?
|
||||
actionFitByWidth->setText("Fit by width"); // TODO: what should it called?
|
||||
actionCopyPixmap->setText(QCoreApplication::translate("MainWindow", "Copy P&ixmap", nullptr));
|
||||
actionCopyFilePath->setText(QCoreApplication::translate("MainWindow", "Copy &File Path", nullptr));
|
||||
actionPaste->setText(QCoreApplication::translate("MainWindow", "&Paste", nullptr));
|
||||
actionToggleCheckerboard->setText(QCoreApplication::translate("MainWindow", "Toggle Checkerboard", nullptr));
|
||||
actionToggleStayOnTop->setText(QCoreApplication::translate("MainWindow", "Stay on top", nullptr));
|
||||
actionToggleProtectMode->setText(QCoreApplication::translate("MainWindow", "Protected mode", nullptr));
|
||||
actionSettings->setText(QCoreApplication::translate("MainWindow", "Configure...", nullptr));
|
||||
@ -65,6 +83,7 @@ void ActionManager::retranslateUi(MainWindow *mainWindow)
|
||||
|
||||
void ActionManager::setupShortcuts()
|
||||
{
|
||||
actionActualSize->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0));
|
||||
actionZoomIn->setShortcut(QKeySequence(QKeySequence::ZoomIn));
|
||||
actionZoomOut->setShortcut(QKeySequence(QKeySequence::ZoomOut));
|
||||
actionHorizontalFlip->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
|
||||
|
Reference in New Issue
Block a user