How to put a label below a transparent QCommandLink?



  • I want to add a label below a QCommandLinkButton.
    example:

    QString button_text="Room,AREA1";
    QVBoxLayout layout=new QVBoxLayout(ui->scrollAreaWidgetContents);
    for(int i=0;i<64;i++){
    QLabel  *label[i]=new Qlabel();
    label[i]->setText("Zone 1");
    label[i]->setStyleSheet("color:rgb(58,177,75);\n"
                                 "font-family: \"Helvetica Neue LT W1G\";\n"
                                 "font-size: 14px;\n"
                                 "background-color:none;\n"
                                 "margin-top:-5px"
                                 );
    
    buttons[i]=new QCommandLinkButton();
    buttons[i]->setStyleSheet(QString::fromUtf8( "background-color: none;\n"
                                        "color:black;\n"
                                        "border: 1px solid rgb(190,190,190) ;\n"
                                        "border-width: 1px 0px 0px 0px;\n"
                                        "font-family: \"Helvetica Neue LT W1G\";\n"
                                        "font-size: 10px;\n"
                                        "text-align:center"
                                                           ));
    buttons[i]->setFocusPolicy(Qt::NoFocus);
    buttons[i]->setText(button_text.toStdString().c_str());
    
    ui->scrollAreaWidgetContents->layout()->addWidget(label[i]);
    ui->scrollAreaWidgetContents->layout()->addWidget(buttons[i]);
    
    

    But in order to get a sentence like this:

    Zone1 Room,AREA1
    

    I got this sentence:

               Room,AREA1
    Zone1
    

    How can I fix this ??


Log in to reply
 

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