グループボックスのグループ名を上側の枠線の中央(上下方向に考えて)
に表示する様にコードを作りましたが、旨く行きません。
(下記参照)
つまり、枠線の中にグループ名を表示するのでは無く、枠線上に
表示出来ないでしょうか?
Q1)この件に関して、コメントを頂ければ、有り難いです。
//添付コード================
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QHBoxLayout>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
setGeometry(0,0,400,300);
QHBoxLayout *hlayout1=new QHBoxLayout;
hlayout1->addWidget(ui->gMsrSngl);
hlayout1->addSpacing(60);
hlayout1->addWidget(ui->gMsrCombi);
//=====================
ui->gMsrSngl->setStyleSheet("QGroupBox::title{
subcontrol-origin: border;
subcontrol-position: top center; }");
ui->gMsrSngl->setStyleSheet("QGroupBox{color:black; background-color:#f2f3f4;
border:2px solid blue; border-radius:6px;
padding: 0px 3px;}");
ui->gMsrCombi->setStyleSheet("QGroupBox{
subcontrol-origin: border;
subcontrol-position: top center;
margin-top: 0ex;
color:black; background-color:#f2f3f4;
border:2px solid blue; border-radius:6px;
padding: 0px 3px;}");
以下、省略
}
以上、宜しくお願いします。
あなたの回答
tips
プレビュー