Results 1 to 3 of 3

Thread: protected function changeevent

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: protected function changeevent

    Lets have a look at that code:

    Qt Code:
    1. void MainWindow::changeEvent(QEvent *e)
    2. {
    3. QMainWindow::changeEvent(e);
    4. switch (e->type()) {
    5. case QEvent::LanguageChange:
    6. ui->retranslateUi(this);
    7. break;
    8. default:
    9. break;
    10. }
    11. }
    To copy to clipboard, switch view to plain text mode 

    This function gets called when the main window received a change event. This can be all sorts of things, but in this case, the code specifically targets language changes (QEvent::LanguageChange). If the language changed, the UI gets automatically retranslated. Anything else gets handled by the main window itself.

    This is needed because you add custom controls to your window. If you don't react on this change in your main window subclass, only the standard items of the main window get retranslated, but not your own controls.

  2. The following user says thank you to tbscope for this useful post:

    fearu (25th September 2010)

Similar Threads

  1. Replies: 11
    Last Post: 12th July 2009, 16:01
  2. Replies: 2
    Last Post: 22nd January 2008, 15:15
  3. About Password Protected Files:
    By vermarajeev in forum Qt Programming
    Replies: 7
    Last Post: 16th February 2007, 14:46
  4. ALT+TAB & changeEvent
    By munna in forum Qt Programming
    Replies: 2
    Last Post: 5th September 2006, 19:15
  5. Replies: 1
    Last Post: 11th June 2006, 22:25

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.