mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 03:26:05 -04:00
Minor style fixes
Fixed the height of selector to show 6 elements maximum Reduced distance between filters Increased margin between choiceItem and container box All of the choicebox is now clickable and shows up the list on click
This commit is contained in:
parent
b3a0542ba7
commit
00392aebfd
@ -32,7 +32,8 @@ KiwixChoiceBox::KiwixChoiceBox(QWidget *parent) :
|
||||
choiceSelector = new KiwixListWidget(parent);
|
||||
choiceSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
choiceSelector->setMaximumWidth(250);
|
||||
choiceSelector->setMaximumHeight(200);
|
||||
// allow maximum 6 elements
|
||||
choiceSelector->setMaximumHeight(KListWidgetItem::getItemHeight() * 6);
|
||||
choiceSelector->setCursor(Qt::PointingHandCursor);
|
||||
choiceSelector->setVerticalScrollMode(QAbstractItemView::ScrollMode::ScrollPerPixel);
|
||||
choiceSelector->setFocusPolicy(Qt::FocusPolicy::NoFocus);
|
||||
@ -40,7 +41,7 @@ KiwixChoiceBox::KiwixChoiceBox(QWidget *parent) :
|
||||
choiceSelector->setStyleSheet(styleSheet);
|
||||
choiceSelector->setSelectionMode(QAbstractItemView::SelectionMode::MultiSelection);
|
||||
|
||||
currentChoicesLayout = new FlowLayout(ui->currentChoices, 2, 2, 2);
|
||||
currentChoicesLayout = new FlowLayout(ui->currentChoices, 4, 2, 2);
|
||||
searcher = new KiwixLineEdit();
|
||||
searcher->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
currentChoicesLayout->addWidget(searcher);
|
||||
@ -100,6 +101,10 @@ KiwixChoiceBox::KiwixChoiceBox(QWidget *parent) :
|
||||
connect(this, &KiwixChoiceBox::choiceUpdated, [=]() {
|
||||
choiceSelector->setVisible(false);
|
||||
});
|
||||
|
||||
connect(this, &KiwixChoiceBox::clicked, [=]() {
|
||||
searcher->setFocus();
|
||||
});
|
||||
}
|
||||
|
||||
KiwixChoiceBox::~KiwixChoiceBox()
|
||||
@ -107,6 +112,13 @@ KiwixChoiceBox::~KiwixChoiceBox()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void KiwixChoiceBox::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
emit(clicked());
|
||||
}
|
||||
}
|
||||
|
||||
void KiwixChoiceBox::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Escape) {
|
||||
|
@ -36,9 +36,11 @@ public:
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
|
||||
signals:
|
||||
void choiceUpdated(QStringList);
|
||||
void clicked();
|
||||
|
||||
private:
|
||||
Ui::kiwixchoicebox *ui;
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>274</width>
|
||||
<height>325</height>
|
||||
<width>268</width>
|
||||
<height>50</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -26,6 +26,12 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
|
Loading…
x
Reference in New Issue
Block a user