Results 1 to 2 of 2

Thread: check modified for tab widgets

  1. #1

    Default check modified for tab widgets

    HI,
    I have a main window with tabWidget that contains multiple tabs.
    tabs are widgets like QTextEdit or user define graphic widgets.
    I have been having hard time to figure out how to detect changes from those tabs.
    I need to detect changes.
    so that i can change the tab name to file.txt* when the changes are unsaved. (need the asterisk).
    and ask user if they want to save before close.

    From what i researched, changes can be found by
    QWdiget::isWindowModified()
    or the QUndoGroup/QUndoStack frame works.


    i tried
    if(QWidget::isWindowModified())
    {
    QMessageBox msgBox;
    msgBox.setText("The document has been modified.");
    msgBox.exec();
    }
    but it does not seem to work.

    regarding to the undo frame work. Seems like it has to hard coded every actions/commands for undo and redo.
    in other words, have to implement the actions that cause the undo to be enable.
    is there an easy way to check isModified for Widgets?

  2. #2
    Join Date
    Mar 2011
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: check modified for tab widgets

    to detect tabchange do this: (assume *tabWidget is an object QTabwidget)
    signal for detecting tab change : tabWidget->currentChanged()
    To determine to which tab, it is changed, use: tabWidget->currentIndex()

Similar Threads

  1. URL last modified
    By tsd-charlie in forum Qt Programming
    Replies: 1
    Last Post: 2nd October 2009, 15:09
  2. Modified TextFinder example
    By LoomVortex in forum Newbie
    Replies: 4
    Last Post: 26th August 2009, 11:17
  3. modified files
    By Raajesh in forum Qt Programming
    Replies: 1
    Last Post: 20th May 2008, 13:17
  4. Check file is modified?
    By mamyte03@gmail.com in forum Qt Programming
    Replies: 6
    Last Post: 20th September 2007, 13:03
  5. Check if a file has been modified
    By Dark_Tower in forum Qt Programming
    Replies: 6
    Last Post: 13th April 2006, 21:27

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.