Alex Rivera | Logout

Qt Hide Taskbar Item

Asked 2010-10-29T20:08:21.433
30

I have a custom QWidget and I simple don't want it to show up in the taskbar. I have a QSystemTrayIcon for managing exiting/minimizing etc.

Edit
Report

1 Answer

25

I think the only thing you need here is some sort of parent placeholder widget. If you create your widget without a parent it is considered a top level window. But if you create it as a child of a top level window it is considered a child window und doesn't get a taskbar entry per se. The parent window, on the other hand, also doesn't get a taskbar entry because you never set it visible: This code here works for me:

class MyWindowWidget : public QWidget
{
public:
    MyWindowWidget(QWidget *parent)
        : QWidget(parent, Qt::Dialog)
    {

    }
};

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QMainWindow window;

    MyWindowWidget widget(&window);
    widget.show();

    return app.exec();
}

No taskbar entry is ever shown, if this is want you intended.

answered 2010-10-30T09:09:52.217

Your Answer