2017-07-21 18:21:34 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "QskSelectionSubWindow.h"
|
|
|
|
#include "QskSimpleListBox.h"
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
class ListBox final : public QskSimpleListBox
|
|
|
|
{
|
2018-08-03 08:15:28 +02:00
|
|
|
public:
|
|
|
|
ListBox( QskSelectionSubWindow* subWindow )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
|
|
|
setObjectName( QStringLiteral( "QskSelectionSubWindowListBox" ) );
|
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
connect( this, &QskSimpleListBox::selectedRowChanged,
|
|
|
|
subWindow, &QskSelectionSubWindow::selectedRowChanged );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
connect( this, &QskSimpleListBox::selectedEntryChanged,
|
|
|
|
subWindow, &QskSelectionSubWindow::selectedEntryChanged );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
connect( this, &QskSimpleListBox::entriesChanged,
|
|
|
|
subWindow, &QskSelectionSubWindow::entriesChanged );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
// how to find a reasonable default size ???
|
2018-07-31 17:32:25 +02:00
|
|
|
QSizeF contentsSizeHint() const override
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
|
|
|
return QSizeF( 500, 500 );
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
QskSelectionSubWindow::QskSelectionSubWindow( QQuickItem* parent )
|
|
|
|
: Inherited( parent )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
|
|
|
setInputControl( new ListBox( this ) );
|
2018-11-05 13:29:52 +01:00
|
|
|
setActions( QskDialog::Ok | QskDialog::Cancel );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
QskSelectionSubWindow::~QskSelectionSubWindow()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskSelectionSubWindow::setEntries( const QStringList& entries )
|
|
|
|
{
|
|
|
|
auto listBox = static_cast< ListBox* >( inputControl() );
|
|
|
|
listBox->setEntries( entries );
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList QskSelectionSubWindow::entries() const
|
|
|
|
{
|
|
|
|
const auto* listBox = static_cast< const ListBox* >( inputControl() );
|
|
|
|
return listBox->entries();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QskSelectionSubWindow::setSelectedRow( int row )
|
|
|
|
{
|
|
|
|
auto* listBox = static_cast< ListBox* >( inputControl() );
|
|
|
|
listBox->setSelectedRow( row );
|
|
|
|
}
|
|
|
|
|
|
|
|
int QskSelectionSubWindow::selectedRow() const
|
|
|
|
{
|
|
|
|
const auto listBox = static_cast< const ListBox* >( inputControl() );
|
|
|
|
return listBox->selectedRow();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString QskSelectionSubWindow::selectedEntry() const
|
|
|
|
{
|
|
|
|
const auto listBox = static_cast< const ListBox* >( inputControl() );
|
|
|
|
return listBox->selectedEntry();
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "moc_QskSelectionSubWindow.cpp"
|