Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Handling changes in applications
Qt 6.11 is out! See what's new in the release blog

Handling changes in applications

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    advseo32
    wrote on last edited by
    #1

    Hello ,

    i have a problem to figure out how people do to handle changes in their application

    for example when i make some change , add , delete , draw in the application and after that , i click in close

    button a Warrning message box will appear to informe me that i have some changes none saved

    i guess that people using globale variable , but i'm not sure what the right approche to use it

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You indeed need to use some global state, usually a simple boolean value is enough. Usually this kind of property is referred to as the "dirty" flag.

      QWidget actually includes some helper convenience methods for you in this regard: see "this link":http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#windowModified-prop. You can use this (advantages: it's already there, and cross-platform), or implement your own.

      (Z(:^

      1 Reply Last reply
      0
      • A Offline
        A Offline
        advseo32
        wrote on last edited by
        #3

        [quote author="sierdzio" date="1383393558"]You indeed need to use some global state, usually a simple boolean value is enough. Usually this kind of property is referred to as the "dirty" flag.

        QWidget actually includes some helper convenience methods for you in this regard: see "this link":http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#windowModified-prop. You can use this (advantages: it's already there, and cross-platform), or implement your own.[/quote]

        Yeah cool!!

        but really i don't know ,

        when my application contains many windows

        mainwindow, and window1,window2 ...etc . and there is somme

        changes happned in window2 or window1, how i can detect that one of

        this windows is the responsible for that change ?

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Loop through all your windows and check their state with isWindowModified().

          (Z(:^

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved