2017-11-07 6 views
0
ui->setupUi(this); 

QWidget *win = new QWidget(); 
QVBoxLayout* lay = new QVBoxLayout(win); 
lay->setAlignment(Qt::AlignTop | Qt::AlignLeft); 

QPushButton *botton = new QPushButton(cmd); 
lay->addWidget(botton); 


ui->scrollAreaWidgetContents->setLayout(lay); 

データを整列左にそれを変更したいが整列し、私はデータを可能にするものにしようとしていますここ数日から左揃え にこれを変更したいれます左揃えですが、変更されていません この点について助けてくれる人は誰でも構いません。スクロールは、エリアデータは、センターが中央揃えされたスクロールエリアに

+0

ボタンを左に揃えたいですか? – Simon

答えて

0

スペーサーアイテムを水平レイアウトに追加します。

QHBoxLayout * poHLayout = new QHBoxLayout; 
    QPushButton * button = new QPushButton(cmd); 

    // Spacer item 
    QWidget * poSpacerItem = new QWidget(this); 

    poSpacerItem->setSizePolicy(
        QSizePolicy::Minimum,QSizePolicy::Maximum); 

    // Add your button to the left side. (will align button to left) 
    poHLayout->addWidget(button);  
    // Add spacer item 
    poHLayout->addWidget(poSpacerItem); 


    ui->scrollAreaWidgetContents->setLayout(poHLayout); 
+0

@スラヴァン:あなたはこの質問に何か助けが必要ですか? – Simon

関連する問題