Results 1 to 4 of 4

Thread: Making my Application sole focus !

  1. #1
    Join Date
    Apr 2009
    Posts
    20
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question Making my Application sole focus !

    Hi All,

    I have designed a dialog with a pixmap, some labels and a progress bar !

    When i execute the code, it appears but unless i move the mouse inside the application and click the mouse inside it, the progressbar doesnt show its progressing ! I think this must be the focus of the window right ?

    How can i achieve this automatically ??

    Really need some help !

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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: Making my Application sole focus !

    Progress bar has nothing to do with focus. It has to be something else, please show us your code.
    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
    Apr 2009
    Posts
    20
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Making my Application sole focus !

    Hi Wysota,

    You absolutely right !

    Indeed it has nothing to do with the progressBar, but instead i am applying a Qpalette to change the highlight color of the progress bar !

    Once i do this, when i run the application, it no longer shows the progressbar progressing !

    Can you shed some light ?

    Once i comment out my attempts to change the color, it works as expected !

    Qt Code:
    1. //QPalette pal;
    2. //QColorGroup cg;
    3. //cg.setColor( QColorGroup::Foreground, white );
    4. //cg.setColor( QColorGroup::Background, black );
    5. //cg.setColor( QColorGroup::Highlight, white );
    6. //cg.setColor( QColorGroup::HighlightedText, white );
    7. //cg.setColor( QColorGroup::Text, white );
    8. //pal.setActive( cg );
    9.  
    10. pb = new QProgressBar( this, "pb" );
    11. pb->setGeometry( QRect( 10, 130, 370, 24 ) );
    12. //pb->setPalette( pal );
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Apr 2009
    Posts
    20
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Smile Re: Making my Application sole focus !

    After some tests i managed to find a working solution !

    If i apply the palette to the dialog / widget, the progressBar will inherit these colors at its construction and display these correctly.

    If however, you apply the palette directly on the progressBar after its construction, a mouse click inside the active window is required to display it as expected.

    I am still uncertain why the mouse click inside the active window then initiates its display ??

    However, this does pose a problem if one wanted to have two progress bars (or indeed any 2 widgets) with 2 seperate Palette's.

    Looking forward to your feedback.

    Regards

    Fassage

Similar Threads

  1. Making Application Plugin-Aware
    By assismvla in forum Qt Programming
    Replies: 3
    Last Post: 23rd April 2009, 13:35
  2. How detective lost focus application ?
    By Torsten in forum Qt Programming
    Replies: 2
    Last Post: 6th August 2008, 14:19
  3. removing focus of application?
    By triperzonak in forum Qt Programming
    Replies: 0
    Last Post: 16th July 2008, 15:17
  4. making an application window non resizable
    By aegis in forum Qt Programming
    Replies: 16
    Last Post: 13th May 2007, 19:14
  5. Replies: 3
    Last Post: 26th September 2006, 12: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.