Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 2477:dbc08fae9077
More context menu layout tweaks
author | Chris Cannam |
---|---|
date | Wed, 25 Mar 2020 15:46:56 +0000 |
parents | 6a46b1d4f0cd |
children | f08485694541 |
comparison
equal
deleted
inserted
replaced
2476:6a46b1d4f0cd | 2477:dbc08fae9077 |
---|---|
5056 { | 5056 { |
5057 m_paneStack->setCurrentPane(pane); | 5057 m_paneStack->setCurrentPane(pane); |
5058 m_rightButtonMenu->popup(position); | 5058 m_rightButtonMenu->popup(position); |
5059 } | 5059 } |
5060 | 5060 |
5061 #ifdef Q_OS_LINUX | |
5062 #define MENU_LEFT_INDENT \ | |
5063 (m_viewManager->scalePixelSize(5) + \ | |
5064 2 * qApp->style()->pixelMetric(QStyle::PM_SmallIconSize)) | |
5065 #else | |
5066 #ifdef Q_OS_WIN | |
5067 #define MENU_LEFT_INDENT \ | |
5068 (9 + qApp->style()->pixelMetric(QStyle::PM_SmallIconSize)) | |
5069 #else | |
5070 #define MENU_LEFT_INDENT 17 | |
5071 #endif | |
5072 #endif | |
5073 | |
5061 void | 5074 void |
5062 MainWindow::panePropertiesRightButtonMenuRequested(Pane *pane, QPoint position) | 5075 MainWindow::panePropertiesRightButtonMenuRequested(Pane *pane, QPoint position) |
5063 { | 5076 { |
5064 if (m_lastRightButtonPropertyMenu) { | 5077 if (m_lastRightButtonPropertyMenu) { |
5065 delete m_lastRightButtonPropertyMenu; | 5078 delete m_lastRightButtonPropertyMenu; |
5072 | 5085 |
5073 QWidgetAction *wa = new QWidgetAction(m); | 5086 QWidgetAction *wa = new QWidgetAction(m); |
5074 QLabel *title = new QLabel; | 5087 QLabel *title = new QLabel; |
5075 title->setText(tr("<b>Pane</b>")); | 5088 title->setText(tr("<b>Pane</b>")); |
5076 title->setMargin(m_viewManager->scalePixelSize(3)); | 5089 title->setMargin(m_viewManager->scalePixelSize(3)); |
5077 title->setIndent(m_viewManager->scalePixelSize(12) + | 5090 title->setIndent(MENU_LEFT_INDENT); |
5078 qApp->style()->pixelMetric(QStyle::PM_SmallIconSize)); | |
5079 wa->setDefaultWidget(title); | 5091 wa->setDefaultWidget(title); |
5080 m->addAction(wa); | 5092 m->addAction(wa); |
5081 | 5093 |
5082 m->addSeparator(); | 5094 m->addSeparator(); |
5083 | 5095 |
5113 title->setText | 5125 title->setText |
5114 (tr("<b>%2</b>") | 5126 (tr("<b>%2</b>") |
5115 .arg(XmlExportable::encodeEntities | 5127 .arg(XmlExportable::encodeEntities |
5116 (layer->getLayerPresentationName()))); | 5128 (layer->getLayerPresentationName()))); |
5117 title->setMargin(m_viewManager->scalePixelSize(3)); | 5129 title->setMargin(m_viewManager->scalePixelSize(3)); |
5118 title->setIndent(m_viewManager->scalePixelSize(12) + | 5130 title->setIndent(MENU_LEFT_INDENT); |
5119 qApp->style()->pixelMetric(QStyle::PM_SmallIconSize)); | |
5120 wa->setDefaultWidget(title); | 5131 wa->setDefaultWidget(title); |
5121 m->addAction(wa); | 5132 m->addAction(wa); |
5122 | 5133 |
5123 m->addSeparator(); | 5134 m->addSeparator(); |
5124 | 5135 |