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
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ListBox( QskSelectionSubWindow* window )
|
|
|
|
{
|
|
|
|
setObjectName( QStringLiteral( "QskSelectionSubWindowListBox" ) );
|
|
|
|
|
2017-10-30 12:06:19 +01:00
|
|
|
connect( this, SIGNAL( selectedRowChanged(int) ),
|
|
|
|
window, SIGNAL( selectedRowChanged(int) ) );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2017-10-30 12:06:19 +01:00
|
|
|
connect( this, SIGNAL( selectedEntryChanged(const QString&) ),
|
|
|
|
window, SIGNAL( selectedEntryChanged(const QString&) ) );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
connect( this, SIGNAL( entriesChanged() ),
|
|
|
|
window, SIGNAL( entriesChanged() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
#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
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
QskSelectionSubWindow::QskSelectionSubWindow( QQuickItem* parent ):
|
|
|
|
Inherited( parent )
|
|
|
|
{
|
|
|
|
setInputControl( new ListBox( this ) );
|
|
|
|
setStandardButtons( QskDialog::Ok | QskDialog::Cancel );
|
|
|
|
}
|
|
|
|
|
|
|
|
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"
|