-
Notifications
You must be signed in to change notification settings - Fork 11
/
quickaccess.h
52 lines (43 loc) · 1.17 KB
/
quickaccess.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#include <QCompleter>
#include <QDialog>
#include <QLineEdit>
#include <QListView>
#include <QMainWindow>
#include <QMenuBar>
class QuickAccess : public QDialog{
Q_OBJECT
public:
explicit QuickAccess(QMainWindow* mwnd, uint itemSize, uint windowWidth);
void display();
Q_PROPERTY(uint windowWidth READ getWindowWidth WRITE setWindowWidth)
Q_PROPERTY(uint itemSize READ getItemSize WRITE setItemSize)
void setWindowWidth(uint value){
m_windowWidth = value;
if(txt != NULL){
auto completer = txt->completer();
QListView* popup = static_cast<QListView*>(completer->popup());
popup->setMinimumWidth(value);
}
}
void setItemSize(uint value){
m_itemSize = value;
if(txt != NULL){
auto completer = txt->completer();
completer->setMaxVisibleItems(value);
}
}
uint getWindowWidth(){
return m_windowWidth;
}
uint getItemSize(){
return m_itemSize;
}
private slots:
void txtReturnPressed();
private:
QLineEdit* txt = nullptr;
QMenuBar* menuBar = nullptr;
uint m_windowWidth;
uint m_itemSize;
};