int main(int argc, char *argv[])
{
//The main window just has a label in it's center
QLabel* mainLabel
= new QLabel("Main Widget Label", mainWindow
);
mainWindow->setCentralWidget(mainLabel);
//This dock window should appear 50% transparent. Instead it is fully opaque.
dockWidget->setWidget(pushButton);
dockWidget->setWindowOpacity(0.5);
mainWindow->addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
//Just to show transparent can work, this seperate widget does show up 50% transparent.
w->setWindowOpacity(0.5);
//Show the windows.
mainWindow->show();
w->show();
return app.exec();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
//The main window just has a label in it's center
QMainWindow* mainWindow = new QMainWindow(0,0);
QLabel* mainLabel = new QLabel("Main Widget Label", mainWindow);
mainWindow->setCentralWidget(mainLabel);
//This dock window should appear 50% transparent. Instead it is fully opaque.
QDockWidget* dockWidget = new QDockWidget("Dock Widget", mainWindow);
QPushButton* pushButton = new QPushButton("Dock Widget Button", dockWidget);
dockWidget->setWidget(pushButton);
dockWidget->setWindowOpacity(0.5);
mainWindow->addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
//Just to show transparent can work, this seperate widget does show up 50% transparent.
QWidget *w = new QWidget(0,0);
QPushButton* floatingPushButton = new QPushButton("Floating Widget Button", w);
w->setWindowOpacity(0.5);
//Show the windows.
mainWindow->show();
w->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks