Drawing a line in between QVBoxLayout



  • I need to draw a line between each LED in QVBoxlayout or QHBoxlayout. In below link, any idea?
    http://qt-project.org/doc/qt-5/qtwidgets-statemachine-trafficlight-example.html

    Another question, can the width and height of the Ellipse determined.
    painter.drawEllipse(0, 0, width(), height());



  • I have several ideas.
    You can follow the example of LightWidget and create a LineWidget that draw a line and put into the QVBoxLayout between the LEDs.
    Or you can draw the line directly on the LightWidget on top and bottom and add two boolean property for enable the display of the line above or below
    Or you can use a default empty QWidget with a fixed height representing the height of your line and use the Qt Style Sheet to set the background of the QWidget that will correspond to the color of the line.
    Or you can use a QFrame and setting the border style and dimension in such way that will appear as a single line.



  • thanks, i got it


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.