[SOMEHOW SOLVED] QStatusBar - draw frameless widgets



  • Hello everybody,
    I'm painting my own widget on status bar and have some trouble with it.

    On windows, status bar draws two small lines on the right of my widget, one horizontal and one vertical:
    !http://vip2006.net/statusbar.png(StatusBar Windows)!

    And on Linux system, same code draws a border around the widget:
    !http://vip2006.net/statusbarlin.png(StatusBar Linux)!

    How do I get them off?

    My widget is subclass of QWidget:
    @
    class ExStatusText : public QWidget
    {
    Q_OBJECT

    public:
    ExStatusText(QWidget *parent = NULL);
    void SetText(const QString & text);

    protected:
    void paintEvent(QPaintEvent *);

    private:
    QStaticText m_staticText;
    QPixmap clock;
    };

    ExStatusText::ExStatusText(QWidget *parent):QWidget(parent),clock(":/TecArtStarter/Resources/clock.png")
    {

    }

    void ExStatusText::SetText(const QString & text)
    {
    this->m_staticText.setText(text);
    QTimer::singleShot(1,this,SLOT(update()));
    }

    void ExStatusText::paintEvent(QPaintEvent *)
    {
    QPainter painter(this);
    painter.drawPixmap(0,0,this->clock);
    painter.drawStaticText(this->clock.width()+5,0,this->m_staticText);
    }

    //here is how I'm adding it to the QStatusBar
    this->crmtime = new ExStatusText();
    this->ui.statusBar->addWidget(this->crmtime,1);
    @



  • You can try to set style sheet to border: none, or, if you have available option, you can try to set frameShape to NoFrame.



  • have tried this allready... doesn't help... looks like I must subclass QStatusBar and reimplement its paintEvent...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.