[Lprof-devel] lprof/src/libqtlcmswidgets qtlcmswidgets.cpp, 1.42, 1.42.2.1 qtlcmswidgets.h, 1.15, 1
Brought to you by:
hvengel
|
From: Amit K. <ami...@us...> - 2009-06-10 19:38:12
|
Update of /cvsroot/lprof/lprof/src/libqtlcmswidgets In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14655 Modified Files: Tag: GSoC-2009 qtlcmswidgets.cpp qtlcmswidgets.h Log Message: Problems that were coming before are not coming now. I think now it is working good. I was getting errors in ProfileSelector and IT8Selector when qt3support was disabled only. This errors was due to the fact that these were inheriting class BaseSelector. BaseSelector was inherited by q3hbox class that is not present in qt4. In qt4 the functionality of q3hbox can be obtained by creating a simple QWidget instance and a QHBoxLayout type layout. So i made change in /src/libqtlcmswidgets/qtlcmswidgets.cpp and /src/libqtlcmswidgets/qtlcmswidgets.h files. I made BaseSelector to inherit from QWidget. And attached a QHBoxLayout type layout named layout_baseselector. Then I attached all widget previously attached to baseslector to this layout. Index: qtlcmswidgets.h =================================================================== RCS file: /cvsroot/lprof/lprof/src/libqtlcmswidgets/qtlcmswidgets.h,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -C2 -d -r1.15 -r1.15.2.1 *** qtlcmswidgets.h 6 Mar 2008 21:18:58 -0000 1.15 --- qtlcmswidgets.h 10 Jun 2009 19:38:08 -0000 1.15.2.1 *************** *** 43,47 **** #include <QLineEdit> #include <QPainter> ! #include "lcmsprf.h" --- 43,47 ---- #include <QLineEdit> #include <QPainter> ! #include <QWidget> #include "lcmsprf.h" *************** *** 50,53 **** --- 50,55 ---- // It has bed designed to never be extended anymore + // changed by me =========================================================================== + /* class BaseSelector: public Q3HBox { *************** *** 121,124 **** --- 123,207 ---- }; + */ + + + class BaseSelector: public QWidget { + + + Q_OBJECT + Q_PROPERTY(QString FileMask READ ReadFileMask WRITE WriteFileMask); + Q_PROPERTY(QString Dir READ ReadDir WRITE WriteDir); + Q_PROPERTY(QString Prompt READ getPrompt WRITE setPrompt); + Q_PROPERTY(int lUseDescriptor READ getUseDescriptor WRITE setUseDescriptor); + Q_PROPERTY(int lForOutput READ getForOutput WRITE setForOutput);; + + public: + + BaseSelector(QString ThePrompt, QString DefaultDir, QString Mask = "*.*", BOOL lUseLineEdit = FALSE, BOOL showFileDialog = TRUE, + QWidget* parent=0, const char* name=0, Qt::WFlags f=0); + + QString getFilename() const; + void setFilename(const QString name); + + QString getPrompt() const { return Prompt->text(); } + void setPrompt(QString text) { Prompt->setText(text); } + + + QString ReadFileMask() const { return FileMask; } + void WriteFileMask(QString Mask) { FileMask = Mask; } + + QString ReadDir() const { return Dir; } + void WriteDir(QString TheDir) { Dir= TheDir; } + + void setCurrItem(int n) { Combo->setCurrentItem(n); } + int getCurrItem() { return Combo->currentItem(); } + int count() {return Combo->count();} + + void setUseDescriptor(int n) { lUseDescriptor = n; } + int getUseDescriptor() const { return lUseDescriptor; } + + void setForOutput(int n) { lUseDescriptor = n; } + int getForOutput() const { return lUseDescriptor; } + + + void setDirCaption(QString text) { PickButton->setText(text); } + + + QString Dir; + QString FileMask; + int lUseDescriptor; + int lUseLineEdit; + int lForOutput; + + virtual void FillValues() = 0; + + protected: + + QStringList Descriptions, FileNames; + QLabel* Prompt; + QComboBox* Combo; + QLineEdit* LineEdit; + QPushButton* PickButton; + + QPushButton* NewButtonPtr; + + protected slots: + + void slotButtonClicked(); + void slotValueChanged(); + + signals: + + void valueChanged(); + + + }; + + + + + //=================================================================== + + Index: qtlcmswidgets.cpp =================================================================== RCS file: /cvsroot/lprof/lprof/src/libqtlcmswidgets/qtlcmswidgets.cpp,v retrieving revision 1.42 retrieving revision 1.42.2.1 diff -C2 -d -r1.42 -r1.42.2.1 *** qtlcmswidgets.cpp 6 Mar 2008 21:18:58 -0000 1.42 --- qtlcmswidgets.cpp 10 Jun 2009 19:38:08 -0000 1.42.2.1 *************** *** 77,80 **** --- 77,82 ---- // A selector widget + //removed by me ============================================================= + /* BaseSelector::BaseSelector(QString ThePrompt, QString DefaultDir, QString Mask, BOOL lLineEdit, BOOL showFileDialog, *************** *** 122,125 **** --- 124,197 ---- connect( Combo, SIGNAL( activated(int) ), this, SLOT( slotValueChanged() ) ); } + */ + + BaseSelector::BaseSelector(QString ThePrompt, QString DefaultDir, + QString Mask, BOOL lLineEdit, BOOL showFileDialog, + QWidget* parent, const char* name, Qt::WFlags f) : + QWidget(parent, f), //changed ======= + Dir(DefaultDir), + FileMask(Mask), + lUseDescriptor(0), + lUseLineEdit(lLineEdit) + { + //added ========================================== + //now on when we want to add any widget we will add to layout_baseselector instead to this. + setAccessibleName(QString(QLatin1String(name))); + QHBoxLayout *layout_baseselector = new QHBoxLayout; + layout_baseselector->setSpacing(10); + layout_baseselector->setContentsMargins(2,2,2,2); + this->setLayout(layout_baseselector); + //=============================================== + + lForOutput = FALSE; + //Prompt = new QLabel(ThePrompt, this); + Prompt=new QLabel(ThePrompt); //added=== + this->layout()->addWidget(Prompt); //added=== + Prompt->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + Prompt->setSizePolicy(QSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred)); + + if (lUseLineEdit) + { + // LineEdit = new QLineEdit(this); + LineEdit = new QLineEdit(); //added=== + this->layout()->addWidget(LineEdit); //added=== + Prompt->setBuddy(LineEdit); + Combo = NULL; + } + else + { + // Combo = new QComboBox(FALSE, this), + Combo =new QComboBox(FALSE); //added=== + this->layout()->addWidget(Combo); //added=== + Combo->setEditable(FALSE); + Combo-> setSizePolicy(QSizePolicy (QSizePolicy::Expanding, QSizePolicy::Preferred)); + Prompt->setBuddy(Combo); + LineEdit = NULL; + } + + //setMargin(2); //implemented this when created layout + //setSpacing(10); + if (showFileDialog) + { + //PickButton = new QPushButton(this); + PickButton = new QPushButton(); //added=== + this->layout()->addWidget(PickButton); //added=== + + PickButton -> setSizePolicy(QSizePolicy (QSizePolicy::Minimum, QSizePolicy::Preferred)); + PickButton-> setText(tr (" Select Directory ")); + NewButtonPtr = NULL; + connect(PickButton, SIGNAL( clicked() ), this, SLOT( slotButtonClicked() ) ); + } + + if (lUseLineEdit) + connect( LineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotValueChanged() ) ); + else + connect( Combo, SIGNAL( activated(int) ), this, SLOT( slotValueChanged() ) ); + } + + //=================================================================== + + + |