3
Qtが新しく、ウィンドウの右側にドッキングするDockWidgetを作成しようとしています。ドックの幅の最大値と最小値を設定します(下のコードを参照)。ドックウィジェットはQt::LeftDockWidgetArea
が付加されている場合、これは動作しますが、それはQt::RightDockWidgetArea
で追加されたときに、ドックはこのように、ウィンドウの中央に出て「パディング」である:私はおそらくでドックをサイジングするわけではない QDockWidgetがメインウィンドウの右側にドッキングしたときにサイズが正しくない
このウィンドウのコードは次のとおりです。
int main(int argv, char** args)
{
QApplication app(argv, args);
QMainWindow window;
QDesktopWidget* desktop = QApplication::desktop();
//Docks
QDockWidget* propertyDock = new QDockWidget("",&window);
QWidget* propertyDockContents = new QWidget;
//This sets the window in the center of the screen.
int wWidth = 800; int wHeight = 600;
window.setGeometry(QRect((desktop->width()-wWidth)/2 , (desktop->height()-wHeight)/2 ,wWidth,wHeight));
propertyDock->setAllowedAreas(Qt::RightDockWidgetArea);
propertyDockContents->setMaximumWidth(200);
propertyDockContents->setMinimumWidth(20);
propertyDock->setWidget(propertyDockContents);
window.addDockWidget(Qt::RightDockWidgetArea,propertyDock);
window.show();
return app.exec();
}
「正しい」方法はありますか?ドキュメントに記載されているように