Dear all, in a previous post (Masked widget glitch) I asked suggestions about making an arrow-like widget (see picture in [1]). The old and bad code used a mask, but it had a glitch, as you see in the picture; however, the workaround was easy: doing show, hide, show. Ugly but it worked.
I was suggested to move my code to a new QWidget subclass, painting the background, but now I'm finding it hard to create even the simplest form. What I've achieved so far is very lousy (see picture in [2]): the ugly hack I've used before seems better than this one. Can anyone help me understand how to draw a good-looking widget? Thanks & Cheers! [1] https://dl.dropboxusercontent.com/u/15635416/mask.png [2] https://dl.dropboxusercontent.com/u/15635416/paint.png ToolWindow::ToolWindow(QWidget *parent, QWidget *follow) : QWidget(parent, Qt::FramelessWindowHint) { setAttribute(Qt::WA_TranslucentBackground); } void ToolWindow::paintEvent(QPaintEvent *event) { QPainter p(this); const int h = 10; const int w = 12; QPoint path[7]; path[0] = QPoint( 0, h); path[1] = QPoint( w , h); path[2] = QPoint( w * 2, 0); path[3] = QPoint( w * 3, h); path[4] = QPoint(width(), h); path[5] = QPoint(width(), height()); path[6] = QPoint( 0, height()); p.drawPolygon(path, 7); } _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest