Results 1 to 8 of 8

Thread: how to delete a QToolButton inQt

  1. #1
    Join Date
    Jul 2013
    Posts
    25
    Qt products
    Qt5
    Platforms
    Windows

    Default how to delete a QToolButton inQt

    I want to delete A toolbutton,which is created dynamically.
    So first wwe want to identify which toolbutton is active and then delete it.
    The following code can't identify the active tool button and even delete it.
    here unselectedButtinMap[instance] displays the lastcreated button. but the sender function gives the windows id.
    So they wont match and can't delete the QToolButton.
    foreach(QString instance, unselectButtonMap.keys())
    {
    if(unselectButtonMap[instance] == QObject::sender())
    {
    QMessageBox::warning(0,tr("Warning"),tr("do you want to delete the folder"));
    unselectButtonMap[instance]->hide;
    }}
    Can any one suggest any other method?
    Also suggest a method to delete the QToolButton.

    Thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to delete a QToolButton inQt

    The sender() function returns a pointer to the object that emitted the signal, not any "windows id".
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2013
    Posts
    25
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: how to delete a QToolButton inQt

    How will I get the current object reference?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to delete a QToolButton inQt

    What do you consider a "current object"?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jul 2013
    Posts
    25
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: how to delete a QToolButton inQt

    Which object the user clicks is reffered to as current object.

  6. #6
    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 delete a QToolButton inQt

    Quote Originally Posted by Soumya Somasekhar Ram View Post
    Which object the user clicks is reffered to as current object.
    may this can help u ..
    http://qt-project.org/doc/qt-4.8/qap...ml#focusWidget

    use
    qApp->focusWidget();
    the widget u can remove using delete.
    "Behind every great fortune lies a crime" - Balzac

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to delete a QToolButton inQt

    Quote Originally Posted by Soumya Somasekhar Ram View Post
    Which object the user clicks is reffered to as current object.
    Very weird.... Are you sure you shouldn't be using GraphicsView?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Jul 2013
    Posts
    25
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: how to delete a QToolButton inQt

    I want to maintain a gridlayout.While adding buttons,it should be in the row by column manner and when we delete any item, the remaining items should be rearranged to maintain the currect layout.
    can u suggest any method to neatly arrange the buttons.
    Thanks in advance.

Similar Threads

  1. QToolButton & setStyleSheet
    By kavinsiva in forum Newbie
    Replies: 1
    Last Post: 3rd June 2010, 14:52
  2. Replies: 4
    Last Post: 19th February 2009, 11:10
  3. Need help with QToolButton
    By philipp1 in forum Qt Programming
    Replies: 12
    Last Post: 27th October 2006, 15:37
  4. Problem with qtoolbutton
    By moowy in forum Qt Programming
    Replies: 1
    Last Post: 22nd September 2006, 13:30
  5. Need help with QToolButton
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 22nd April 2006, 14:55

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.