Unsolved Custom popup widget
-
Is there a tutorial or any idea of how to create popup widget like this:
-
@Dohisev hi,friend.welcome.
I think, you can use
QWidget
. when1.00x
widget get the mouse focus or clicked. theslider
widget show and move it to right position. and setslider
widget get focus. whenslider
widget lose focus, hide it. -
@joeQ How to set the position of another widget based on the current clicked widget?
-
@Dohisev every widget has
Geometry
in Qt. you can searchWindow Geometry
key words in Qt help manual. and thenQWidget::move(x,y)
. don't forget to thewidget width and height
.widget also has
pos()
andrect
properties. -
Hi,
Isn't that the VLC GUI ?
-
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
mButton = new QPushButton;
mSlider = new QSlider;
mMainLayout = new QVBoxLayout;
mLayout = new QVBoxLayout;
mLayout->addWidget(mButton);
this->setLayout(mLayout);
connect(mButton,SIGNAL(clicked()),this,SLOT(SLT_ShowPopUp()));
}void Widget::SLT_ShowPopUp(){
mSlider->setGeometry(this->x(),this->y()+100,200,30);
mSlider->setWindowFlags(Qt::Popup);
mSlider->setOrientation(Qt::Horizontal);
mSlider->setRange(0,100);
connect(mSlider,SIGNAL(valueChanged(int)),this,SLOT(SLT_SetValue(int)));
mSlider->show();
}void Widget::SLT_SetValue(int val){
mSlider->setValue(val);
mButton->setText(QString::number(val));
}