Results 1 to 4 of 4

Thread: change text size and window size - qmessagebox

  1. #1
    Join Date
    Mar 2013
    Posts
    45
    Thanks
    23
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default change text size and window size - qmessagebox

    hi

    i want to change text size and window size of qmessagebox,it is very small :

    small_Qmessagebox.JPG

    i want change to :

    small_Qmessagebox2.jpg

    tnx

  2. #2
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: change text size and window size - qmessagebox

    You can change the text size using html. For that :-
    Qt Code:
    1. msgBox->setText("<font size="5">" + string + </font>);
    To copy to clipboard, switch view to plain text mode 

    And for the size of messagebox
    Qt Code:
    1. msgBox->setFixedSize(width,height);
    To copy to clipboard, switch view to plain text mode 
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  3. The following user says thank you to sonulohani for this useful post:

    smemamian (3rd July 2013)

  4. #3
    Join Date
    Mar 2013
    Posts
    45
    Thanks
    23
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: change text size and window size - qmessagebox

    Thank you for your reply.
    1- it is correct :

    Qt Code:
    1. msgBox->setText("<font size=5>" + string + "</font>");
    To copy to clipboard, switch view to plain text mode 

    2- messagebox does not change !

    Qt Code:
    1. StringClass strclass;
    2. QMessageBox mb(" Win ","<font size=10>" +
    3. strclass.getStringOne() + "</font>" ,QMessageBox::NoIcon,
    4. QMessageBox::Ok | QMessageBox::Default,
    5. QMessageBox::NoButton,
    6. QMessageBox::NoButton);
    7.  
    8. QPixmap exportSuccess(":/PIC/award.png");
    9. mb.setIconPixmap(exportSuccess);
    10. QPalette palette;
    11. palette.setBrush(QPalette::Background,QBrush(QImage(":/PIC/award.png")));
    12. mb.setFixedSize(100,100);
    13. mb.exec()
    To copy to clipboard, switch view to plain text mode 


  5. #4
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Thumbs up Re: change text size and window size - qmessagebox

    Check with this:-
    Qt Code:
    1. QMessageBox msg(this);
    2. msg.setIconPixmap(QPixmap(":/error.svg"));
    3. msg.setText("No images loaded");
    4. msg.setInformativeText("There are no images in the list. Please create or load a project");
    5. msg.setStandardButtons(QMessageBox::Ok);
    6. msg.setDefaultButton(QMessageBox::Ok);
    7.  
    8. QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    9. QGridLayout* layout = (QGridLayout*)msg.layout();
    10. layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
    11. msg.exec();
    To copy to clipboard, switch view to plain text mode 
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  6. The following user says thank you to sonulohani for this useful post:

    smemamian (4th July 2013)

Similar Threads

  1. Replies: 2
    Last Post: 13th December 2012, 13:56
  2. Replies: 1
    Last Post: 18th October 2011, 11:02
  3. Get window size prior to showing window?
    By mortoray in forum Qt Programming
    Replies: 0
    Last Post: 13th January 2011, 16:52
  4. how to change size of window... stupid mistake
    By Sergio_Almonte in forum Qt Programming
    Replies: 2
    Last Post: 30th November 2007, 15:00
  5. Change shape of window / animate window
    By sabeesh in forum Qt Programming
    Replies: 3
    Last Post: 31st October 2007, 08:16

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.