Add option to limit the number of windows selected in the DialogSubWindowSelector
This commit is contained in:
1 parent
e84525dee7
commit
9630b1d0e5
2 files changed
+20
-6
No files matched your search
@@ -30,14 +30,13 @@
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, QMdiArea *mdiArea ) :
|
||||
QDialog( parent )
|
||||
DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, QMdiArea *mdiArea, Int numberWindowsSelected ) :
|
||||
QDialog( parent ),
|
||||
m_iNumberOfSelectedWindows( numberWindowsSelected ),
|
||||
m_pcMainWindowMdiArea( mdiArea )
|
||||
{
|
||||
QFont titleFont, menusFont;
|
||||
|
||||
// Set variables
|
||||
m_pcMainWindowMdiArea = mdiArea;
|
||||
|
||||
titleFont.setPointSize( 14 );
|
||||
titleFont.setBold( true );
|
||||
titleFont.setWeight( 75 );
|
||||
@@ -64,6 +63,7 @@ DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, QMdiArea *mdi
|
||||
|
||||
m_pushButtonAdd = new QPushButton( "Add", this );
|
||||
m_pushButtonRemove = new QPushButton( "Remove", this );
|
||||
m_pushButtonRemove->setEnabled( false );
|
||||
|
||||
// Selected Sub Window List
|
||||
m_listSelectedWindows = new QListWidget( this );
|
||||
@@ -138,6 +138,11 @@ void DialogSubWindowSelector::addSubWindow()
|
||||
m_listSelectedWindows->insertItems( 0, m_pcSelectedWindowListNames );
|
||||
updateSubWindowList();
|
||||
}
|
||||
if( m_pcSelectedWindowListNames.size() >= m_iNumberOfSelectedWindows )
|
||||
{
|
||||
m_pushButtonAdd->setEnabled( false );
|
||||
}
|
||||
m_pushButtonRemove->setEnabled( true );
|
||||
}
|
||||
|
||||
void DialogSubWindowSelector::removeSubWindow()
|
||||
@@ -158,6 +163,14 @@ void DialogSubWindowSelector::removeSubWindow()
|
||||
m_listSelectedWindows->insertItems( 0, m_pcSelectedWindowListNames );
|
||||
updateSubWindowList();
|
||||
}
|
||||
if( m_pcSelectedWindowListNames.size() < m_iNumberOfSelectedWindows )
|
||||
{
|
||||
m_pushButtonAdd->setEnabled( true );
|
||||
}
|
||||
if( m_pcSelectedWindowListNames.size() == 0 )
|
||||
{
|
||||
m_pushButtonRemove->setEnabled( false );
|
||||
}
|
||||
}
|
||||
|
||||
} // Namespace SCode
|
||||
@@ -51,7 +51,7 @@ class DialogSubWindowSelector: public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DialogSubWindowSelector( QWidget *parent = 0, QMdiArea *mdiArea = 0 );
|
||||
DialogSubWindowSelector( QWidget *parent = 0, QMdiArea *mdiArea = 0, Int numberWindowsSelected = -1 );
|
||||
|
||||
Void setSubWindowList( QStringList cWindowListNames );
|
||||
QStringList getSelectedWindows()
|
||||
@@ -59,6 +59,7 @@ public:
|
||||
return m_pcSelectedWindowListNames;
|
||||
}
|
||||
private:
|
||||
Int m_iNumberOfSelectedWindows;
|
||||
QMdiArea* m_pcMainWindowMdiArea;
|
||||
QStringList m_pcWindowListNames;
|
||||
QStringList m_pcSelectedWindowListNames;
|
||||
|
||||
Reference in new issue
Block a user