r19954 by craig - Remove messy toolbutton/pushbutton mix and defines. Style status bar and make sizes more consistent.
scribus-commit
scribus-commit at lists.scribus.net
Sun Mar 29 09:48:25 UTC 2015
Author: craig
Date: Sun Mar 29 09:48:25 2015
New Revision: 19954
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19954
Log:
Remove messy toolbutton/pushbutton mix and defines. Style status bar and make sizes more consistent.
Modified:
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribus.h
trunk/Scribus/scribus/scribusview.cpp
trunk/Scribus/scribus/styleoptions.h
trunk/Scribus/scribus/ui/pageselector.cpp
trunk/Scribus/scribus/ui/pageselector.h
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19954&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Mar 29 09:48:25 2015
@@ -64,7 +64,6 @@
#include <QStyleFactory>
#include <QTableWidget>
#include <QTextCodec>
-#include <QToolButton>
#include <QTranslator>
#include <QWheelEvent>
@@ -1203,12 +1202,20 @@
int posi = fo.pointSize() - (ScCore->isWinGUI() ? 1 : 2);
fo.setPointSize(posi);
unitSwitcher = new QComboBox( this );
+ unitSwitcher->setObjectName("unitSwitcher");
unitSwitcher->setFocusPolicy(Qt::NoFocus);
unitSwitcher->setFont(fo);
int maxUindex = unitGetMaxIndex() - 2;
for (int i = 0; i <= maxUindex; ++i)
unitSwitcher->addItem(unitGetStrFromIndex(i));
- zoomSpinBox = new ScrSpinBox( 1, 32000, this, 6 );
+
+
+ QWidget* zoomWidget = new QWidget( statusBar() );
+ QHBoxLayout* zoomLayout = new QHBoxLayout( zoomWidget );
+ zoomLayout->setMargin(0);
+ zoomLayout->setSpacing(1);
+
+ zoomSpinBox = new ScrSpinBox( 1, 32000, zoomWidget, 6 );
zoomSpinBox->setTabAdvance(false);
zoomSpinBox->setFont(fo);
zoomSpinBox->setValue( 100 );
@@ -1216,51 +1223,70 @@
zoomSpinBox->setFocusPolicy(Qt::ClickFocus);
zoomSpinBox->setSuffix( tr( " %" ) );
layerMenu = new QComboBox( this );
+ layerMenu->setObjectName("layerMenu");
layerMenu->setEditable(false);
layerMenu->setFont(fo);
layerMenu->setFocusPolicy(Qt::NoFocus);
layerMenu->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+ QString downArrow(ScPaths::instance().iconDir()+"16/go-down.png");
+
+ QString comboStyleSheet1 ("QComboBox#layerMenu { border: 1px solid gray; height: 20px; width:5em; }"
+ "QComboBox::down-arrow { image: url("+downArrow+"); width: 12px; height 12px;}"
+ "QComboBox::down-arrow:on { top: 1px; left: 1px; }"
+ "QComboBox:editable { background: white; }"
+ "QComboBox:!editable, QComboBox::drop-down:editable { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);}"
+ "QComboBox:!editable:on, QComboBox::drop-down:editable:on { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D3D3D3, stop: 0.4 #D8D8D8, stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1); }"
+ "QComboBox:on { padding-top: 3px; padding-left: 4px; }"
+ "QComboBox::drop-down { subcontrol-origin: padding; subcontrol-position: top right; width: 15px; border-left-width: 1px; border-left-color: darkgray; border-left-style: solid; border-top-right-radius: 3px; border-bottom-right-radius: 3px; }"
+
+ );
+
+ QString comboStyleSheet2 ("QComboBox#unitSwitcher { border: 1px solid gray; height: 20px; width:2em; }"
+ "QComboBox::down-arrow { image: url("+downArrow+"); width: 12px; height 12px;}"
+ "QComboBox::down-arrow:on { top: 1px; left: 1px; }"
+ "QComboBox:editable { background: white; }"
+ "QComboBox:!editable, QComboBox::drop-down:editable { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);}"
+ "QComboBox:!editable:on, QComboBox::drop-down:editable:on { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D3D3D3, stop: 0.4 #D8D8D8, stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1); }"
+ "QComboBox:on { padding-top: 3px; padding-left: 4px; }"
+ "QComboBox:drop-down { subcontrol-origin: padding; subcontrol-position: top right; width: 20px; border-left-width: 1px; border-left-color: darkgray; border-left-style: solid; }"
+
+ );
+
+ QString buttonStyleSheet("QPushButton { height: 20px; width: 20px; border: 0px; } "
+ "QPushButton:hover { border: 1px solid gray ; }"
+ "QPushButton:pressed { border: 1px solid gray; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dadbde, stop: 1 #f6f7fa); }");
+
+ QString zoomStyleSheet("QSpinBox { height: 20px; width: 3em; padding-right: 15px; }"
+ );
+
pageSelector = new PageSelector(this, 1);
+ pageSelector->setObjectName("pageSelector");
pageSelector->setFont(fo);
pageSelector->setFocusPolicy(Qt::ClickFocus);
-#if OPTION_USE_QTOOLBUTTON
- zoomDefaultToolbarButton = new QToolButton(this);
- zoomInToolbarButton = new QToolButton(this);
- zoomOutToolbarButton = new QToolButton(this);
- zoomDefaultToolbarButton->setAutoRaise(OPTION_FLAT_BUTTON);
- zoomOutToolbarButton->setAutoRaise(OPTION_FLAT_BUTTON);
- zoomInToolbarButton->setAutoRaise(OPTION_FLAT_BUTTON);
- zoomInToolbarButton->setDefaultAction(scrActions["toolsZoomIn"]);
- zoomOutToolbarButton->setDefaultAction(scrActions["toolsZoomOut"]);
-#else
- zoomDefaultToolbarButton = new QPushButton(this);
+ zoomDefaultToolbarButton = new QPushButton(zoomWidget);
zoomDefaultToolbarButton->setFocusPolicy(Qt::NoFocus);
zoomDefaultToolbarButton->setDefault( false );
zoomDefaultToolbarButton->setAutoDefault( false );
- zoomDefaultToolbarButton->setFlat(OPTION_FLAT_BUTTON);
- zoomOutToolbarButton = new QPushButton(this);
+ zoomOutToolbarButton = new QPushButton(zoomWidget);
zoomOutToolbarButton->setFocusPolicy(Qt::NoFocus);
zoomOutToolbarButton->setDefault( false );
zoomOutToolbarButton->setAutoDefault( false );
- zoomOutToolbarButton->setFlat(OPTION_FLAT_BUTTON);
- zoomInToolbarButton = new QPushButton(this);
+ zoomInToolbarButton = new QPushButton(zoomWidget);
zoomInToolbarButton->setFocusPolicy(Qt::NoFocus);
zoomInToolbarButton->setDefault( false );
zoomInToolbarButton->setAutoDefault( false );
- zoomInToolbarButton->setFlat(OPTION_FLAT_BUTTON);
- zoomInToolbarButton->addAction(scrActions["toolsZoomIn"]);
- zoomOutToolbarButton->addAction(scrActions["toolsZoomOut"]);
-#endif
+
zoomDefaultToolbarButton->setIcon(QIcon(loadIcon("16/zoom-original.png")));
zoomOutToolbarButton->setIcon(QIcon(loadIcon("16/zoom-out.png")));
zoomInToolbarButton->setIcon(QIcon(loadIcon("16/zoom-in.png")));
- zoomOutToolbarButton->resize(10,10);
-// cmsAdjustMenu = new QMenu();
-// idCmsAdjustMenu = cmsAdjustMenu->addAction( "Configure CMS...", this, SLOT(adjustCMS()));
-// cmsToolbarButton->setMenu(cmsAdjustMenu);
-
+
+
+ zoomLayout->addWidget( zoomSpinBox );
+ zoomLayout->addWidget( zoomOutToolbarButton );
+ zoomLayout->addWidget( zoomDefaultToolbarButton );
+ zoomLayout->addWidget( zoomInToolbarButton );
mainWindowStatusLabel = new QLabel( " ", statusBar());
mainWindowStatusLabel->setFont(fo);
@@ -1272,33 +1298,40 @@
mainWindowXPosLabel->setFont(fo);
mainWindowYPosLabel = new QLabel( tr("Y:"), statusBar());
mainWindowYPosLabel->setFont(fo);
- mainWindowXPosDataLabel = new QLabel( " ", statusBar());
+ mainWindowXPosDataLabel = new QLabel( "", statusBar());
mainWindowXPosDataLabel->setFont(fo);
- mainWindowYPosDataLabel = new QLabel( " ", statusBar());
+ mainWindowYPosDataLabel = new QLabel( "", statusBar());
mainWindowYPosDataLabel->setFont(fo);
-
+ mainWindowXPosDataLabel->setMinimumWidth(mainWindowXPosDataLabel->fontMetrics().width("99999.999"));
+ mainWindowYPosDataLabel->setMinimumWidth(mainWindowYPosDataLabel->fontMetrics().width("99999.999"));
statusBarLanguageChange();
-
statusBar()->setFont(fo);
statusBar()->addPermanentWidget(mainWindowStatusLabel, 5);
QLabel *s=new QLabel("");
QLabel *s2=new QLabel("");
+ QLabel *s3=new QLabel("");
statusBar()->addPermanentWidget(s,1);
- statusBar()->addPermanentWidget(zoomSpinBox,1);
- statusBar()->addPermanentWidget(zoomOutToolbarButton,1);
- statusBar()->addPermanentWidget(zoomDefaultToolbarButton,1);
- statusBar()->addPermanentWidget(zoomInToolbarButton,1);
- statusBar()->addPermanentWidget(pageSelector,3);
+ statusBar()->addPermanentWidget(s2,1);
+ statusBar()->addPermanentWidget(zoomWidget,0);
+ statusBar()->addPermanentWidget(pageSelector,0);
statusBar()->addPermanentWidget(layerMenu,1);
- statusBar()->addPermanentWidget(s2,2);
+ statusBar()->addPermanentWidget(s3,3);
statusBar()->addPermanentWidget(mainWindowXPosLabel, 0);
- statusBar()->addPermanentWidget(mainWindowXPosDataLabel, 1);
+ statusBar()->addPermanentWidget(mainWindowXPosDataLabel, 0);
statusBar()->addPermanentWidget(mainWindowYPosLabel, 0);
- statusBar()->addPermanentWidget(mainWindowYPosDataLabel, 1);
+ statusBar()->addPermanentWidget(mainWindowYPosDataLabel, 0);
+
statusBar()->addPermanentWidget(unitSwitcher,0);
statusBar()->addPermanentWidget(mainWindowProgressBar, 0);
connect(statusBar(), SIGNAL(messageChanged(const QString &)), this, SLOT(setTempStatusBarText(const QString &)));
+
+ layerMenu->setStyleSheet(comboStyleSheet1);
+ unitSwitcher->setStyleSheet(comboStyleSheet2);
+ zoomDefaultToolbarButton->setStyleSheet(buttonStyleSheet);
+ zoomInToolbarButton->setStyleSheet(buttonStyleSheet);
+ zoomOutToolbarButton->setStyleSheet(buttonStyleSheet);
+ zoomSpinBox->setStyleSheet(zoomStyleSheet);
}
Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19954&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Sun Mar 29 09:48:25 2015
@@ -42,7 +42,6 @@
#include <QPushButton>
#include <QProcess>
#include <QString>
-#include <QToolButton>
class QCloseEvent;
class QDragEnterEvent;
@@ -211,15 +210,9 @@
QProgressBar* mainWindowProgressBar;
ScrSpinBox* zoomSpinBox; //zoom spinbox at bottom of view
PageSelector* pageSelector; //Page selector at bottom of view
-#if OPTION_USE_QTOOLBUTTON
- QToolButton *zoomDefaultToolbarButton;
- QToolButton *zoomOutToolbarButton;
- QToolButton *zoomInToolbarButton;
-#else
QPushButton *zoomDefaultToolbarButton;
QPushButton *zoomOutToolbarButton;
QPushButton *zoomInToolbarButton;
-#endif
QComboBox *layerMenu; //Menu for layers at bottom of view
QComboBox *unitSwitcher; //Menu for units at bottom of view
EditToolBar *editToolBar;
Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19954&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sun Mar 29 09:48:25 2015
@@ -393,9 +393,9 @@
void ScribusView::startGesture(CanvasGesture* gesture)
{
- qDebug() << "start gesture" << typeid(*m_canvasMode).name()
- << "---->"
- << typeid(*gesture).name();
+ //qDebug() << "start gesture" << typeid(*m_canvasMode).name()
+ // << "---->"
+ // << typeid(*gesture).name();
if (m_canvasMode != gesture)
{
m_canvasMode->deactivate(true);
@@ -409,7 +409,7 @@
void ScribusView::stopGesture()
{
- qDebug() << "stop gesture" << typeid(*m_canvasMode).name() << (m_canvasMode->delegate() != 0);
+ //qDebug() << "stop gesture" << typeid(*m_canvasMode).name() << (m_canvasMode->delegate() != 0);
if (m_canvasMode->delegate())
{
m_canvasMode->deactivate(false);
Modified: trunk/Scribus/scribus/styleoptions.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19954&path=/trunk/Scribus/scribus/styleoptions.h
==============================================================================
--- trunk/Scribus/scribus/styleoptions.h (original)
+++ trunk/Scribus/scribus/styleoptions.h Sun Mar 29 09:48:25 2015
@@ -16,8 +16,6 @@
#ifndef STYLEOPTIONS_H
#define STYLEOPTIONS_H
-#define OPTION_USE_QTOOLBUTTON 1
-#define OPTION_FLAT_BUTTON 1
#ifdef Q_WS_MAC
#define AQUA_EXTRA 20
#else
Modified: trunk/Scribus/scribus/ui/pageselector.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19954&path=/trunk/Scribus/scribus/ui/pageselector.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pageselector.cpp (original)
+++ trunk/Scribus/scribus/ui/pageselector.cpp Sun Mar 29 09:48:25 2015
@@ -7,19 +7,17 @@
#include "pageselector.h"
#include <QEvent>
+#include <QHBoxLayout>
+#include <QLabel>
#include <QLineEdit>
-#if OPTION_USE_QTOOLBUTTON
- #include <QToolButton>
-#else
- #include <QPushButton>
-#endif
-#include <QLabel>
+#include <QPixmap>
+#include <QPushButton>
+#include <QRegExp>
#include <QToolTip>
-#include <QRegExp>
-#include <QPixmap>
-#include <QHBoxLayout>
#include <QValidator>
+
#include "sccombobox.h"
+#include "scpaths.h"
#include "util_icon.h"
#include "util.h"
@@ -32,33 +30,19 @@
PageSelectorLayout->setMargin(0);
PageSelectorLayout->setSpacing(1);
-#if OPTION_USE_QTOOLBUTTON
- startButton = new QToolButton( this );
- startButton->setAutoRaise(OPTION_FLAT_BUTTON);
- backButton = new QToolButton( this );
- backButton->setAutoRaise(OPTION_FLAT_BUTTON);
- forwardButton = new QToolButton( this );
- forwardButton->setAutoRaise(OPTION_FLAT_BUTTON);
- lastButton = new QToolButton( this );
- lastButton->setAutoRaise(OPTION_FLAT_BUTTON);
-#else
startButton = new QPushButton( this );
startButton->setDefault( false );
startButton->setAutoDefault( false );
- startButton->setFlat(OPTION_FLAT_BUTTON);
backButton = new QPushButton( this );
backButton->setDefault( false );
backButton->setAutoDefault( false );
- backButton->setFlat(OPTION_FLAT_BUTTON);
forwardButton = new QPushButton( this );
forwardButton->setDefault( false );
forwardButton->setAutoDefault( false );
- forwardButton->setFlat(OPTION_FLAT_BUTTON);
lastButton = new QPushButton( this );
lastButton->setDefault( false );
lastButton->setAutoDefault( false );
- lastButton->setFlat(OPTION_FLAT_BUTTON);
-#endif
+
startButton->setIcon(QIcon(loadIcon("16/go-first.png")));
startButton->setFocusPolicy(Qt::NoFocus);
PageSelectorLayout->addWidget( startButton );
@@ -104,6 +88,28 @@
lastButton->setEnabled(false);
}
+ QString buttonStyleSheet("QPushButton { height: 20px; width: 20px; border: 0px; } "
+ "QPushButton:hover { border: 1px solid gray ; }"
+ "QPushButton:pressed { border: 1px solid gray; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dadbde, stop: 1 #f6f7fa); }");
+ startButton->setStyleSheet(buttonStyleSheet);
+ backButton->setStyleSheet(buttonStyleSheet);
+ forwardButton->setStyleSheet(buttonStyleSheet);
+ lastButton->setStyleSheet(buttonStyleSheet);
+
+ QString downArrow(ScPaths::instance().iconDir()+"16/go-down.png");
+
+ QString comboStyleSheet ("QComboBox { border: 1px solid gray; height: 20px; }"
+ "QComboBox::down-arrow { image: url("+downArrow+"); width: 12px; height 12px;}"
+ "QComboBox::down-arrow:on { top: 1px; left: 1px; }"
+ "QComboBox:editable { background: white; }"
+ "QComboBox:!editable, QComboBox::drop-down:editable { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);}"
+ "QComboBox:!editable:on, QComboBox::drop-down:editable:on { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D3D3D3, stop: 0.4 #D8D8D8, stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1); }"
+ "QComboBox:on { padding-top: 3px; padding-left: 4px; }"
+ "QComboBox::drop-down { subcontrol-origin: padding; subcontrol-position: top right; width: 15px; border-left-width: 1px; border-left-color: darkgray; border-left-style: solid; border-top-right-radius: 3px; border-bottom-right-radius: 3px; }"
+
+ );
+ m_pageCombo->setStyleSheet(comboStyleSheet);
+
languageChange();
// signals and slots connections
connect( m_pageCombo, SIGNAL( activated(int) ), this, SLOT( GotoPgE(int) ) );
Modified: trunk/Scribus/scribus/ui/pageselector.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19954&path=/trunk/Scribus/scribus/ui/pageselector.h
==============================================================================
--- trunk/Scribus/scribus/ui/pageselector.h (original)
+++ trunk/Scribus/scribus/ui/pageselector.h Sun Mar 29 09:48:25 2015
@@ -14,7 +14,6 @@
class QLabel;
class QLineEdit;
class QPushButton;
-class QToolButton;
class QIntValidator;
#include "scribusapi.h"
@@ -37,19 +36,10 @@
void setFont ( const QFont & );
int getCurrentPage();
-#if OPTION_USE_QTOOLBUTTON
- QToolButton* startButton;
- QToolButton* backButton;
- QToolButton* forwardButton;
- QToolButton* lastButton;
-#else
QPushButton* startButton;
QPushButton* backButton;
QPushButton* forwardButton;
QPushButton* lastButton;
-#endif
-
-
public slots:
virtual void setGUIForPage(int i);
More information about the scribus-commit
mailing list