Results 1 to 11 of 11

Thread: Changing appearence of mainwindow according to end user

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2012
    Posts
    33
    Thanks
    9
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Changing appearence of mainwindow according to end user

    Hey..I used this,but whatever i give as input.. blue, white,yellow..it sets it as black itself..
    Qt Code:
    1. void MainWindow::on_Set_clicked()
    2. {
    3. s=ui->bcolor->text();//textbox from wher i get input from user
    4. qApp->setStyleSheet("QLineEdit { background-color:s }");
    5.  
    6. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Changing appearence of mainwindow according to end user

    I would change the code like this:
    Qt Code:
    1. void MainWindow::on_Set_clicked()
    2. {
    3. s=ui->bcolor->text();//textbox from wher i get input from user
    4. qApp->setStyleSheet(QString("QLineEdit { background-color:%1 }").arg(s));
    5. }
    To copy to clipboard, switch view to plain text mode 
    You would also need to check entered value in a lineEdit or use QColorDialog with QColor::name to select necessary color.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

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

    prabhudev (3rd August 2012)

  4. #3
    Join Date
    May 2012
    Posts
    33
    Thanks
    9
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Changing appearence of mainwindow according to end user

    Thanks..It worked..
    spirit U Rock!!!

  5. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Changing appearence of mainwindow according to end user

    You are welcome. It's not me, it's docs
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Android Installation - how and where to add/store changing user files?
    By sedi in forum Installation and Deployment
    Replies: 2
    Last Post: 13th June 2012, 16:58
  2. Changing MainWindow UI from another QThread.
    By EdgeLuxe in forum Newbie
    Replies: 1
    Last Post: 4th September 2010, 15:35
  3. resizing widgets when user resizes mainwindow
    By Mystical Groovy in forum Qt Programming
    Replies: 13
    Last Post: 21st December 2009, 00:03
  4. resizing graphicsView when user resizes mainwindow
    By mirelon in forum Qt Programming
    Replies: 0
    Last Post: 20th December 2009, 22:43
  5. Replies: 3
    Last Post: 15th November 2007, 13:09

Tags for this Thread

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.