Custom popup widget
-
@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. -
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));
}