Results 1 to 8 of 8

Thread: Compile QFileDialog.h

  1. #1
    Join Date
    Mar 2009
    Posts
    116
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Compile QFileDialog.h

    I need to customize QFileDilaog for my application.

    (need to disable its "Navigation" functions and "create folder" function)

    I had subclassed it and thought I would disable these slots
    like this.....
    Qt Code:
    1. dialog->removeAction(QAction::setDisabled (true) [_q_navigateBackward]);
    To copy to clipboard, switch view to plain text mode 


    But all the slots are defined as "Private" so not accessible through object of my derived class.


    So I changed specifier from "private" to "public" in "D:\Qt\4.4.3\src\gui\dialogs\qfiledialog.h" ,so that I can access it in derived class.

    I need to know now ,how to compile this qfiledialog.h file so that my changes would be in effect.

    or is there any alternavite way to acheive this??

  2. #2
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    4
    Thanked 140 Times in 132 Posts

    Default Re: Compile QFileDialog.h

    First of all I don't understand this code:
    Qt Code:
    1. dialog->removeAction(QAction::setDisabled (true) [_q_navigateBackward]);
    To copy to clipboard, switch view to plain text mode 

    And second of all, as I remember from another topic you want to let the user choose the file from some directory, which directory cannot be changed? I think that it would be much easier to just show the some dialog containing some list view (or tree view to have more columns) with files from that directory, and allow user to choose one row and press OK.
    You can get files with QDir::entryList().
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  3. #3
    Join Date
    Mar 2009
    Posts
    116
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Compile QFileDialog.h

    I m like newbie in this Qt world..


    Would anyone tell me how to use simple dialog (instead off QFiledialog) to show diretory files in it...

  4. #4
    Join Date
    Dec 2007
    Posts
    628
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 89 Times in 87 Posts

    Default Re: Compile QFileDialog.h

    Quote Originally Posted by Qt Coder View Post
    Would anyone tell me how to use simple dialog (instead off QFiledialog) to show diretory files in it...
    Use:
    QDirModel
    QTreeView

  5. #5
    Join Date
    Mar 2009
    Posts
    116
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Compile QFileDialog.h

    I have implemented QInputDialog to select images

    Qt Code:
    1. AppPath = QApplication::applicationDirPath();
    2. AppPath.append("/Images");
    3.  
    4. QDir dir = QDir(AppPath);
    5. dir.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
    6. dir.setSorting( QDir::Name);
    7. dir.setNameFilters(filters);
    8.  
    9. QStringList filenames = dir.entryList(filters,QDir::Files, QDir::Name);
    10.  
    11. filepath = QInputDialog::getItem(NULL, tr("Select Image"),
    12. "", filenames, 0, false, &ok);
    To copy to clipboard, switch view to plain text mode 


    Now my problem is,even if I click open/cancel /close its returning me the filename selected in combo box.

    Is there any way to differentiate between accepted and rejected signal of QInputDialog?

  6. #6
    Join Date
    Dec 2007
    Posts
    628
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 89 Times in 87 Posts

    Default Re: Compile QFileDialog.h

    Quote Originally Posted by Qt Coder View Post
    Is there any way to differentiate between accepted and rejected signal of QInputDialog?
    Check this:
    Qt Code:
    1. int returnCode;
    2. returnCode = fileDialog->exec();
    3. if(returnCode == QDialog::Accepted)
    4. do something.
    5. if(returnCode == QDialog::Rejected)
    6. do something else.
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    Mar 2009
    Posts
    116
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Compile QFileDialog.h

    Its giving me error creating object of QInputDialog.
    Qt Code:
    1. ../../../include/QtGui/../../src/gui/dialogs/qinputdialog.h:70:
    2. QInputDialog::~QInputDialog()' is private
    To copy to clipboard, switch view to plain text mode 


    So I m using

    Qt Code:
    1. filepath = QInputDialog::getItem(NULL, tr("Select Image"),
    2. "", filenames, 0, false, &ok);
    To copy to clipboard, switch view to plain text mode 

    but to call
    Qt Code:
    1. fileDialog->exec();
    To copy to clipboard, switch view to plain text mode 

    I will have to instantiate QInputDialog........


    How to?

  8. #8
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    11
    Thanked 16 Times in 16 Posts

    Default Re: Compile QFileDialog.h

    Didnt you read the manual?: http://doc.trolltech.com/4.5/qinputdialog.html#getItem

    If ok is nonnull *a ok will be set to true if the user pressed OK and to false if the user pressed Cancel

Similar Threads

  1. how to compile c++ source file in qtCreator
    By orky7 in forum General Programming
    Replies: 6
    Last Post: 20th March 2009, 07:45
  2. Compile Application in XCode for Release. How?
    By Alex Snet in forum Installation and Deployment
    Replies: 7
    Last Post: 3rd February 2009, 10:16
  3. qtgui4.dll error in visual c++ 2005
    By Comptrol in forum Installation and Deployment
    Replies: 33
    Last Post: 19th June 2008, 08:18
  4. Access to PostgreSQL DB on a linux server
    By rmagro in forum Qt Programming
    Replies: 28
    Last Post: 13th March 2008, 10:02
  5. Use VC2005 to compile Qt program (4.3.0)
    By firegun9 in forum Qt Programming
    Replies: 3
    Last Post: 8th June 2007, 17:04

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.