0
votes

I get a small triangle in left bottom corner or right top corner of the QPushButton I am using. I am not sure how it is showing up. I am just using simple PushButton. I needed same kind of thing for my custom widget derived from QWidget.

I wanted to know is there any flag to set this or do I need to implement explicitly ? Looks like a page turn symbol we see in some online pdf's.

I am kind of new to Qt. Please answer.

1
You can use QWidget::setStyleSheet to set a background with a picture you need. - hank
I am trying to use stylesheet, but i am not able to set the image properly. Its not showing up atleast. I am trying to do it this way. Let me know if i am doing any mistake there. m_pWidget->setStyleSheet("background-image: url(:/icons/Drill_progress_marker_left.svg); background-position: top right"); - vinmm

1 Answers

0
votes

The small triangle indicates that the QPushButton has a popup menu associated: QPushButton::setMenu().

If you want to add a triangle, you can use stylesheet or reimplement QWidget::paintEvent() to paint the triangle in a corner. A basic example:

void Widget::paintEvent( QPaintEvent* event ) {
    QWiudget::paintEvent( event );
    QPainter painter( this );
    QPolygon p();
    p.append( QPoint(10, 10) );
    p.append( QPoint(14, 10) );
    p.append( QPoint(12, 14) );
    painter.drawPolygon( p );
}

But, I think, a better solution would be adding a QPushButton to your widget. It would be easier to detect a click on your triangle...