From ae70389901b18c8a9093cc2f69a9906903296e2e Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 13 Dec 2005 06:29:11 +0000 Subject: [PATCH] Add flag 'readOnly' for FileItem --- src/Qtx/QtxListResourceEdit.cxx | 10 +++++++++- src/Qtx/QtxListResourceEdit.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Qtx/QtxListResourceEdit.cxx b/src/Qtx/QtxListResourceEdit.cxx index 93acf8409..75e74e998 100644 --- a/src/Qtx/QtxListResourceEdit.cxx +++ b/src/Qtx/QtxListResourceEdit.cxx @@ -1303,12 +1303,13 @@ QtxListResourceEdit::FileItem::FileItem( const QString& title, QtxResourceEdit* : PrefItem( Font, edit, pItem, parent ), myFlags( QFileInfo::ReadUser ), myIsExisting( true ), + myIsReadOnly ( true ), myFileDlg( 0 ) { new QLabel( title, this ); myFile = new QLineEdit( this ); myFile->setValidator( new FileValidator( this, myFile ) ); - myFile->setReadOnly( true ); + myFile->setReadOnly( myIsReadOnly ); myOpenFile = new QToolButton( this ); myOpenFile->setText( "..." ); connect( myOpenFile, SIGNAL( clicked() ), this, SLOT( onOpenFile() ) ); @@ -1338,6 +1339,8 @@ QVariant QtxListResourceEdit::FileItem::property( const QString& name ) const return myIsExisting; else if( name=="flags" ) return myFlags; + else if( name=="readOnly") + return myIsReadOnly; return QVariant(); } @@ -1359,6 +1362,11 @@ void QtxListResourceEdit::FileItem::setProperty( const QString& name, const QVar else if( name=="flags" && value.canCast( QVariant::UInt ) ) myFlags = value.toUInt(); + + else if( name=="readOnly" && value.canCast( QVariant::Bool) ) { + myIsReadOnly = value.toBool(); + myFile->setReadOnly( myIsReadOnly ); + } } void QtxListResourceEdit::FileItem::onOpenFile() diff --git a/src/Qtx/QtxListResourceEdit.h b/src/Qtx/QtxListResourceEdit.h index 86bc32f1b..19713ca08 100644 --- a/src/Qtx/QtxListResourceEdit.h +++ b/src/Qtx/QtxListResourceEdit.h @@ -518,6 +518,7 @@ private slots: private: uint myFlags; + bool myIsReadOnly; QStringList myFilter; bool myIsExisting; QLineEdit* myFile; -- 2.39.2