Results 1 to 5 of 5

Thread: how to check the popup direction in qcombobox

  1. #1
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default how to check the popup direction in qcombobox

    hi friends,
    is there any way to check the popup direction of qcombobox . is it any way to check the popup drops up or down ..
    "Behind every great fortune lies a crime" - Balzac

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to check the popup direction in qcombobox

    I guess it happens automatically. Why you need to check manually ?

    For details check the source code of QComboBox::showPopup

  3. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to check the popup direction in qcombobox

    Quote Originally Posted by aamer4yu View Post
    I guess it happens automatically. Why you need to check manually ?

    For details check the source code of QComboBox::showPopup
    my combobox adjust only after i add the forth item in my combobox .. im having some space below where the combobox is placed .. so initial three items will pop down but my requirement is to show pop upwards all the time ..
    actually i have to show the popup in drop up even before qt adjust the orientation .. so i tried this
    :showPopup()
    {
    QComboBox::showPopup();
    QWidget *popup = this->findChild<QFrame*>();


    popup->move(popup->x(),popup->y()-this->height()-popup->height())
    it works .. but when qt adjust the orientation my calculation of move() is going in wrong ..for that reason only im asking if any possible way i can detect ..
    "Behind every great fortune lies a crime" - Balzac

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: how to check the popup direction in qcombobox

    Well, you could first check if the popup's top left is above or below the combobox's rectangle, no?

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    wagmare (6th November 2013)

  6. #5
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to check the popup direction in qcombobox

    done thx!

    qreal yPos = mapToGlobal(this->rect().topLeft()).y();
    if(popup->y() > yPos)
    "Behind every great fortune lies a crime" - Balzac

Similar Threads

  1. QComboBox popup
    By berchio in forum Qt Programming
    Replies: 0
    Last Post: 25th October 2012, 20:05
  2. QComboBox Popup position
    By alitoh in forum Qt Programming
    Replies: 1
    Last Post: 25th November 2011, 10:16
  3. Replies: 1
    Last Post: 4th May 2011, 08:49
  4. QComboBox popup
    By aekilic in forum Qt Programming
    Replies: 9
    Last Post: 6th January 2009, 10:24
  5. Replies: 1
    Last Post: 1st August 2008, 06:59

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.