Custom arc borders on QWidget paint event
Unsolved
General and Desktop
-
How to create a QWidget that looks the same as the image below?
I mean, the widget should have just these kinds of borders, I don't even know how to start it on the QPaintEvent...
i mean how to calculate this ? this looks almost impossible to me, please any helpclass Widget : public QWidget { Q_OBJECT public: Widget() { setStyleSheet("background-color: transparent"); setAttribute(Qt::WA_TranslucentBackground); setWindowFlags(Qt::FramelessWindowHint); }; void paintEvent(QPaintEvent* event) override { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); const int borderWidth = 10; const int cornerRadius = 20; const QColor borderColor(255, 0, 0); QPainterPath path; } }; int main(int argc, char* argv[]) { QApplication a(argc, argv); Widget* w = new Widget; w->show(); return a.exec(); }