-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathCursors.h
37 lines (33 loc) · 1.32 KB
/
Cursors.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
#pragma once
#include <QApplication>
#include <QCursor>
#include <QFrame>
#include <QListWidget>
#include <QMainWindow>
namespace Examples {
class Window1 : public QMainWindow {
Q_OBJECT
public:
Window1() {
listWidgetCursors.move(20, 20);
listWidgetCursors.resize(150, 200);
listWidgetCursors.addItems({"Arrow", "Up arrow", "Cross", "Wait", "IBeam", "Size vertical", "Size horizantal", "Size top-right / bottom-left corner", "Size top-left / bottom-right corner", "Size all", "Blank", "Split vertical", "Split horizontal", "Pointing hand", "Forbidden", "What's this", "Busy", "Open hand", "Closed hand", "Drag copy", "Drag move", "Drag link"});
connect(&listWidgetCursors, &QListWidget::itemSelectionChanged, [&] {
testZone.setCursor({static_cast<Qt::CursorShape>(listWidgetCursors.currentRow())});
});
listWidgetCursors.setCurrentRow(0);
testZone.move(190, 20);
testZone.resize(150, 200);
testZone.setFrameStyle(QFrame::StyledPanel|QFrame::Sunken);
testZone.setAutoFillBackground(true);
testZone.setPalette(qApp->palette().color(QPalette::Base));
setCentralWidget(&frame);
setWindowTitle("Cursor example");
resize(360, 240);
}
private:
QFrame frame;
QListWidget listWidgetCursors {&frame};
QFrame testZone {&frame};
};
}