Results 1 to 2 of 2

Thread: unable to popup the QSlider on top of the pushButton

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2008
    Posts
    16
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Question unable to popup the QSlider on top of the pushButton

    hi ,

    I am able to popup a slider on the click of a button, but it's not on top of the button...
    what should I do ..

    here is the code

    Qt Code:
    1. class MainWindow : public QMainWindow, public Ui::MainWindow
    2. {
    3. Q_OBJECT
    4. public:
    5. MainWindow( QWidget * parent = 0, Qt::WFlags f = 0 );
    6.  
    7.  
    8. QFrame *popup1;
    9.  
    10. private slots:
    11.  
    12. void pushButton_clicked();
    13. };
    14.  
    15. MainWindow::MainWindow( QWidget * parent, Qt::WFlags f)
    16. : QMainWindow(parent, f)
    17. {
    18. setupUi(this);
    19.  
    20. connect(pushButton, SIGNAL(clicked()), this, SLOT(pushButton_clicked()));
    21.  
    22. popup1 = new QFrame( this, Qt::Popup);
    23. popup1->resize(40,100);
    24.  
    25. QSlider *slid = new QSlider(Qt::Vertical, popup1);
    26. slid->resize(40,100);
    27. slid->show();
    28. }
    29.  
    30. void MainWindow:pushButton_clicked()
    31. {
    32. popup1->move(mapToGlobal(pushButton->geometry().bottomLeft()));
    33.  
    34. popup1->show();
    35.  
    36. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by marcel; 16th July 2008 at 10:29. Reason: missing [code] tags

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.