get rid of ugly background on qprogressbar



  • I have created a qprogressbar programmatically and it is showing up with a grey background darker than the grey the statusbar has. I want to know what might be causing it and how to remove it. Here is the relevant code area

        progress = new QProgressBar(this);
        statuslabel.setText("Idle");
        progress->setVisible(true);
        progress->setMinimum(0);
        progress->setMaximum(0);
        ui->statusbar->addWidget(&statuslabel);
        ui->statusbar->addPermanentWidget(progress);
        ui->statusbar->update();
    
    

    and here is where they are declared

    class MainWindow : public QMainWindow
    {
        Q_OBJECT
    
    public:
        QProgressBar *progress;
        QLabel statuslabel;
        QStringList videofiles;
        explicit MainWindow(QWidget *parent = 0);
        ~MainWindow();
        void processDir(QString file);
        QSqlDatabase db;
    
    private slots:
        void on_actionPreferences_triggered();
    
        void on_actionExit_triggered();
    
        void on_addFilesButton_clicked();
    
        void on_scanFilesList_itemSelectionChanged();
    
        void on_removeFilesbutton_clicked();
    
        void on_startButton_clicked();
    
        void on_actionOpen_triggered();
    
    private:
        Ui::MainWindow *ui;
        QString cfgfile;
        bool scanloaded;
        void closeEvent(QCloseEvent *event);
        bool userReallyWantsToQuit();
    };
    

    I am on osx 10.11.2



  • now the background is the matching color for the statusbar, but I didn't change anything that I can see, what the heck?

    ok I see what's happening, when the app first launches the background for qprogressbar is wrong, but if I turn focus to another app and then back it paints it with the correct background color. What could cause that?

    ok edit again. Now I notice that it is the statusbar that is originally painted with a lighter grey and IT is the one repainted when I change focus back to the app, maybe if I set the palette of the statusbar. Maybe the way I created it doesn't use the qapplication default palette?


Log in to reply
 

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