6#include "QskSelectionWindow.h"
7#include "QskSimpleListBox.h"
16 return qobject_cast< QskSimpleListBox* >( window->dialogContentItem() );
22 return qobject_cast< QskSimpleListBox* >( window->dialogContentItem() );
32 setObjectName( QStringLiteral(
"QskSelectionWindowListBox" ) );
34 connect(
this, &QskSimpleListBox::selectedRowChanged,
35 window, &QskSelectionWindow::selectedRowChanged );
37 connect(
this, &QskSimpleListBox::selectedEntryChanged,
38 window, &QskSelectionWindow::selectedEntryChanged );
40 connect(
this, &QskSimpleListBox::entriesChanged,
41 window, &QskSelectionWindow::entriesChanged );
46QskSelectionWindow::QskSelectionWindow( QWindow* parent )
49 setFlags( Qt::Dialog | Qt::WindowTitleHint |
50 Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint );
52 auto listBox =
new ListBox(
this );
54 listBox->setPreferredSize( 500, 500 );
57 setDialogContentItem( listBox );
58 setDialogActions( QskDialog::Ok | QskDialog::Cancel );
61QskSelectionWindow::~QskSelectionWindow()
65void QskSelectionWindow::setEntries(
const QStringList& entries )
67 if (
auto listBox = qskListBox(
this ) )
68 listBox->setEntries( entries );
71QStringList QskSelectionWindow::entries()
const
73 if (
auto listBox = qskListBox(
this ) )
74 return listBox->entries();
79void QskSelectionWindow::setSelectedRow(
int row )
81 if (
auto listBox = qskListBox(
this ) )
82 listBox->setSelectedRow( row );
85int QskSelectionWindow::selectedRow()
const
87 if (
auto listBox = qskListBox(
this ) )
88 return listBox->selectedRow();
93QString QskSelectionWindow::selectedEntry()
const
95 if (
auto listBox = qskListBox(
this ) )
96 return listBox->selectedEntry();
101#include "moc_QskSelectionWindow.cpp"