Results 1 to 2 of 2

Thread: Creating a button programmatically

  1. #1
    Join Date
    Jan 2010
    Posts
    190
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Creating a button programmatically

    Hi! I'm trying to place a button in my window, and I followed the various tutorials. I created the window using the wiard, which created a new class MainWindow, and when I try:

    QPushButton *b = new QPushButton(QString("ciccio"), (QWidget *)w.parent());

    the button is created in a new window and not in mine. How do I have to do to place it in the MainWindow when it was not created as a QWidget like in the tutorials?
    Thanks!

  2. #2
    Join Date
    Jan 2010
    Posts
    190
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Creating a button programmatically

    Sorry, already found :-) there is an object named centralWidget which has to be used.

Similar Threads

  1. Creating Custom Ellipse Button
    By VireX in forum Qt Programming
    Replies: 18
    Last Post: 30th May 2012, 11:23
  2. Select entire row in QTableWidget, programmatically
    By MattPhillips in forum Qt Programming
    Replies: 2
    Last Post: 24th November 2009, 14:51
  3. Programmatically Save Image rendered in a QWebPage
    By last2kn0 in forum Qt Programming
    Replies: 1
    Last Post: 24th November 2008, 06:33
  4. Replies: 3
    Last Post: 3rd September 2008, 16:41
  5. [?] Input text programmatically
    By XuTMAH in forum Newbie
    Replies: 3
    Last Post: 24th September 2007, 16:47

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.