Custom popup widget



  • Is there a tutorial or any idea of how to create popup widget like this:

    widget



  • @Dohisev hi,friend.welcome.

    I think, you can use QWidget. when 1.00x widget get the mouse focus or clicked. the slider widget show and move it to right position. and set slider widget get focus. when slider 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 search Window Geometry key words in Qt help manual. and then QWidget::move(x,y). don't forget to the widget width and height.

    widget also has pos() and rect properties.


  • Lifetime Qt Champion

    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));
    }


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.