[Kst] branches/work/kst/portto4/kst/src/libkstapp
Adam Treat
treat at kde.org
Tue Oct 2 18:13:00 CEST 2007
SVN commit 720176 by treat:
* Use the new Qt4 CSS stylesheet feature to reproduce
the look we had in 1.4.x.
M +19 -16 databutton.cpp
M +0 -3 databutton.h
M +4 -4 datamanager.cpp
--- branches/work/kst/portto4/kst/src/libkstapp/databutton.cpp #720175:720176
@@ -19,28 +19,31 @@
DataButton::DataButton(const QString &text, QWidget *parent)
: QPushButton(text, parent) {
- setBackgroundRole(QPalette::Base);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
-}
+ setStyleSheet("QPushButton {"
+ "border: 1px solid;"
+ "background-color: white;"
+ "text-align: left;"
+ "margin: 5;"
+ "}"
-DataButton::~DataButton() {
+ "QPushButton:hover {"
+ "border-bottom: 1px solid;"
+ "border-right: 1px solid;"
+ "}"
+
+ "QPushButton:pressed {"
+ "border-bottom: 0px solid;"
+ "border-right: 0px solid;"
+ "border-top: 1px solid;"
+ "border-left: 1px solid;"
+ "}"
+ );
}
-void DataButton::paintEvent(QPaintEvent *) {
- QStylePainter p(this);
- QStyleOptionButton option;
- initStyleOption(&option);
-
- option.features = QStyleOptionButton::Flat;
-
- p.drawControl(QStyle::CE_PushButtonBevel, option);
- p.drawPrimitive(QStyle::PE_FrameFocusRect, option);
-
- QRect textPosition(rect());
- textPosition.setX(textPosition.x() + 5);
- p.drawText(textPosition, QPushButton::text(), QTextOption(Qt::AlignLeft|Qt::AlignVCenter));
+DataButton::~DataButton() {
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/databutton.h #720175:720176
@@ -24,9 +24,6 @@
public:
DataButton(const QString & text, QWidget * parent = 0);
virtual ~DataButton();
-
- protected:
- void paintEvent(QPaintEvent *);
};
}
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.cpp #720175:720176
@@ -28,25 +28,25 @@
setupUi(this);
_session->setModel(doc->session());
+ _objects->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
+ _objects->setStyleSheet("background-color: white;");
+
+
_primitives = new QToolBar(_objects);
_primitives->setOrientation(Qt::Vertical);
_primitives->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
- _primitives->setBackgroundRole(QPalette::Base);
_dataObjects = new QToolBar(_objects);
_dataObjects->setOrientation(Qt::Vertical);
_dataObjects->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
- _dataObjects->setBackgroundRole(QPalette::Base);
_fits = new QToolBar(_objects);
_fits->setOrientation(Qt::Vertical);
_fits->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
- _fits->setBackgroundRole(QPalette::Base);
_filters = new QToolBar(_objects);
_filters->setOrientation(Qt::Vertical);
_filters->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
- _filters->setBackgroundRole(QPalette::Base);
_objects->addItem(_primitives, tr("Create Primitive"));
_objects->addItem(_dataObjects, tr("Create Data Object"));
More information about the Kst
mailing list