Skip to content
QtWS25 Last Chance
  • 0 Votes
    5 Posts
    223 Views
    J
    @SGaist Thank you, I get it.
  • QToolButton Style

    Solved General and Desktop qtoolbutton styesheet
    11
    0 Votes
    11 Posts
    2k Views
    SavizS
    @mrjj Thank you, that solved my problem. :)
  • A basic Question

    Solved QML and Qt Quick qml styesheet
    30
    0 Votes
    30 Posts
    11k Views
    sierdzioS
    @mrjj said in A basic Question: It is odd that its not been updated since lots of activities on QML. There was a discussion about it on the mailing list once. If I recall it correctly, the priority for Qt devs working on QML was to keep the engine fast, and make it work 100% reliable in common QML use cases (and the most common uses are: small bindings/ assignments and short functions) - so they did not feel pressure to implement newer features.
  • 0 Votes
    5 Posts
    8k Views
    ILI
    @raven-worx Thanks bro, very helpfull.
  • QToolbar stylesheet

    Solved General and Desktop qtoolbar styesheet
    7
    0 Votes
    7 Posts
    6k Views
    Gianluca86G
    Ok, I tried this: // MyStyle.h #include <QStyle> class MyStyle : public QStyle { public: MyStyle(); virtual int pixelMetric(PixelMetric pm, const QStyleOption* option, const QWidget* widget) const ; }; // MYStyle.cpp #include "MyStyle.h" MyStyle::MyStyle() { } int MyStyle::pixelMetric(PixelMetric pm, const QStyleOption* option, const QWidget* widget) const { if (pm == QStyle::PM_ToolBarExtensionExtent) return 50; return QStyle::pixelMetric(pm, option, widget); } Is it correct? The line return QStyle::pixelMetric(pm, option, widget); give me this error: error: undefined reference to `QStyle::pixelMetric(QStyle::PixelMetric, QStyleOption const*, QWidget const*) const'
  • 0 Votes
    11 Posts
    10k Views
    _M_H__
    Thanks to all for your help. I didn't get it solved with stylesheets, but I found a solution which works for me: class SettingsButton : public QPushButton { Q_OBJECT public: explicit SettingsButton(QWidget *parent = 0); void setText2(const QString &text1, const QString &text2); QString getText1(); QString getText2(); signals: public slots: protected: virtual void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE { QRect rect1(55,0,356,25); QRect rect2(55,25,356,25); QFont font; QPushButton::paintEvent(event); //To draw everything of a normal QPushButton m_color = QColor(Qt::white); //same as in stylesheet QPushButton (normal) if( QWidget::hasFocus() ) { m_color = QColor(Qt::red); //same as in stylesheet QPushButton:focus } if( QWidget::underMouse() ) { m_color = QColor(Qt::blue); //same as in stylesheet QPushButton:hover } if( QPushButton::isDown() ) { m_color = QColor(Qt::green); //same as in stylesheet QPushButton:pressed } //Display additional text QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing, true); painter.setPen(m_color); font = painter.font(); painter.setFont(QFont(font.family(), font.pointSize(), QFont::Bold)); painter.drawText(rect1, Qt::AlignLeft|Qt::AlignVCenter, firstText); painter.setFont(QFont(font.family(), font.pointSize(), QFont::Normal)); painter.drawText(rect2, Qt::AlignRight|Qt::AlignVCenter, secondText); } private: QString firstText; QString secondText; QColor m_color; };
  • Sth hard to explain ...

    Solved General and Desktop qpushbutton styesheet
    3
    0 Votes
    3 Posts
    1k Views
    Z
    Thanks @mrjj I solved it by using :flat flag :)