我的一位同事通过代码创建了一个视频播放器小部件。所以当我想在主滑块的底部添加一个滑块时,我遇到了麻烦。我试图设定其出发点,但似乎没有考虑到这一点。在QT中定位滑块
我尝试了一些基本功能,如setPosition,setGeometry但他们不工作。为了更好地理解问题,我添加了图像 我也粘贴了一个代码片段,它将这些代码片段合并在一起。
QHBoxLayout *basicControlsLayout = new QHBoxLayout;
basicControlsLayout->setMargin(0);
basicControlsLayout->addWidget(open_button_);
basicControlsLayout->addWidget(play_button_);
basicControlsLayout->addWidget(position_slider_);
basicControlsLayout->addWidget(stop_button_);
int* a, *b, *c, *d;
position_slider_->getContentsMargins (a,b,c ,d);
QRect r(*a, *b, *c-*a, *d-*b);
QHBoxLayout *basicScratchLayout = new QHBoxLayout;
// basicScratchLayout->setGeometry(r);
basicScratchLayout->addWidget (position_limit_slider_);
那么我如何让这两个对齐呢?
不客气。也许我会研究一下,如果我有一些空闲时间,可以在没有太多痛苦的情况下叠加它们。 – Predelnik