I want to make something like a semi transparent QTabWidget object which whole the background be semi transparent (even the icons) but the text of the icons and also whole the contents don't be.
To simplify the procedures, I'm trying to make a transparent window, first.
I tried following codes:
setPalette(pal);
setAutoFillBackground(true);
}
void MainWindow::paintEvent(QPaintEvent* ) {
QPalette pal = palette();
pal.setBrush(QPalette::Window, QColor(0, 0, 255, 0) );
setPalette(pal);
setAutoFillBackground(true);
}
To copy to clipboard, switch view to plain text mode
missed1.png
setPalette(pal);
setAutoFillBackground(true);
}
void MainWindow::paintEvent(QPaintEvent* ) {
QPalette pal = palette();
pal.setBrush(QPalette::Window, QColor(0, 0, 255, 255) );
setPalette(pal);
setAutoFillBackground(true);
}
To copy to clipboard, switch view to plain text mode
missed2.png
// QColor backgroundColor = palette().light().color();
// backgroundColor.setAlpha(0);
QColor backgroundColor
=Qt
::TransparentMode;
customPainter.fillRect(rect(),backgroundColor);
}
void MainWindow::paintEvent(QPaintEvent* /*event*/) {
// QColor backgroundColor = palette().light().color();
// backgroundColor.setAlpha(0);
QColor backgroundColor =Qt::TransparentMode;
QPainter customPainter(this);
customPainter.fillRect(rect(),backgroundColor);
}
To copy to clipboard, switch view to plain text mode
missed3.png
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this);
effect->setOpacity(1.0);
setGraphicsEffect(effect);
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this);
effect->setOpacity(1.0);
setGraphicsEffect(effect);
}
To copy to clipboard, switch view to plain text mode
missed4.png
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this);
effect->setOpacity(0.0);
setGraphicsEffect(effect);
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this);
effect->setOpacity(0.0);
setGraphicsEffect(effect);
}
To copy to clipboard, switch view to plain text mode
missed5.png
Anyway "QGraphicsOpacityEffect" is not the thing that I want.
I also tried many other things...
Bookmarks