Skip to content

Commit e3f9f00

Browse files
adminadmin
authored andcommitted
clean
0 parents  commit e3f9f00

652 files changed

Lines changed: 28717 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ignore files
2+
3+
/**/*.user
4+
*.filters
5+
6+
/**/x64
7+
.vs/
8+
9+
/**/Debug/
10+
/**/out/

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# c++ example
2+
[Youtube](https://www.youtube.com/playlist?list=PLZzwFJOgBE3We8y8WGmW_ahJA8BqmfIcR)
3+
# qt
4+
5+
[Youtube](https://www.youtube.com/playlist?list=PLZzwFJOgBE3X-CylW6tD2jgxSYKTl_MrP)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30611.23
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SpliterRubberBand", "SpliterRubberBand\SpliterRubberBand.vcxproj", "{9ABC49E8-6A56-4287-A81B-8E9886D572C9}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x64 = Debug|x64
11+
Release|x64 = Release|x64
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{9ABC49E8-6A56-4287-A81B-8E9886D572C9}.Debug|x64.ActiveCfg = Debug|x64
15+
{9ABC49E8-6A56-4287-A81B-8E9886D572C9}.Debug|x64.Build.0 = Debug|x64
16+
{9ABC49E8-6A56-4287-A81B-8E9886D572C9}.Release|x64.ActiveCfg = Release|x64
17+
{9ABC49E8-6A56-4287-A81B-8E9886D572C9}.Release|x64.Build.0 = Release|x64
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {E629984F-2811-49AD-990C-C33DD072E1D3}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#include "MySplitter.h"
2+
#include <stdexcept>
3+
#include "QMouseEvent"
4+
MySplitter::MySplitter(QWidget* parent)
5+
: QSplitter(parent)
6+
{
7+
8+
}/*
9+
10+
void MySplitter::mousePressEvent(QMouseEvent* event)
11+
{
12+
throw std::logic_error("The method or operation is not implemented.");
13+
}
14+
15+
void MySplitter::mouseReleaseEvent(QMouseEvent* event)
16+
{
17+
throw std::logic_error("The method or operation is not implemented.");
18+
}
19+
20+
void MySplitter::mouseMoveEvent(QMouseEvent* event)
21+
{
22+
throw std::logic_error("The method or operation is not implemented.");
23+
}*/
24+
25+
QSplitterHandle* MySplitter::createHandle()
26+
{
27+
return new MySplitterHandle(this);
28+
}
29+
30+
MySplitter::MySplitterHandle::MySplitterHandle(QSplitter* parent)
31+
: QSplitterHandle(Qt::Horizontal, parent)
32+
{
33+
34+
}
35+
36+
37+
38+
void MySplitter::MySplitterHandle::mouseReleaseEvent(QMouseEvent* event)
39+
{
40+
splitter()->setRubberBand(-1);
41+
42+
//auto* p = parentWidget();
43+
44+
auto pos =parentWidget()->mapFromGlobal(event->globalPos());
45+
46+
moveSplitter(closestLegalPosition( pos.x()));
47+
}
48+
49+
void MySplitter::MySplitterHandle::mouseMoveEvent(QMouseEvent* event)
50+
{
51+
auto pos = parentWidget()->mapFromGlobal(event->globalPos());
52+
53+
splitter()->setRubberBand(closestLegalPosition(pos.x()));
54+
}
55+
56+
MySplitter* MySplitter::MySplitterHandle::splitter()
57+
{
58+
return dynamic_cast<MySplitter*>(__super::splitter());
59+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#pragma once
2+
#include "qsplitter.h"
3+
4+
class MySplitter :
5+
public QSplitter
6+
{
7+
public:
8+
MySplitter(QWidget* parent);
9+
protected:
10+
/* void mousePressEvent(QMouseEvent* event) override;
11+
12+
13+
void mouseReleaseEvent(QMouseEvent* event) override;
14+
15+
16+
void mouseMoveEvent(QMouseEvent* event) override;*/
17+
18+
19+
class MySplitterHandle : public QSplitterHandle {
20+
public:
21+
MySplitterHandle(QSplitter* parent);
22+
23+
24+
void mouseReleaseEvent(QMouseEvent* event) override;
25+
26+
27+
void mouseMoveEvent(QMouseEvent* event) override;
28+
29+
MySplitter* splitter();
30+
};
31+
32+
QSplitterHandle* createHandle() override;
33+
34+
};
35+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "SpliterRubberBand.h"
2+
3+
SpliterRubberBand::SpliterRubberBand(QWidget *parent)
4+
: QMainWindow(parent)
5+
{
6+
ui.setupUi(this);
7+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#pragma once
2+
3+
#include <QtWidgets/QMainWindow>
4+
#include "ui_SpliterRubberBand.h"
5+
6+
class SpliterRubberBand : public QMainWindow
7+
{
8+
Q_OBJECT
9+
10+
public:
11+
SpliterRubberBand(QWidget *parent = Q_NULLPTR);
12+
13+
private:
14+
Ui::SpliterRubberBandClass ui;
15+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<RCC>
2+
<qresource prefix="SpliterRubberBand">
3+
</qresource>
4+
</RCC>
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>SpliterRubberBandClass</class>
4+
<widget class="QMainWindow" name="SpliterRubberBandClass">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>600</width>
10+
<height>400</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>SpliterRubberBand</string>
15+
</property>
16+
<widget class="QWidget" name="centralWidget">
17+
<layout class="QHBoxLayout" name="horizontalLayout">
18+
<item>
19+
<widget class="MySplitter" name="splitter">
20+
<property name="orientation">
21+
<enum>Qt::Horizontal</enum>
22+
</property>
23+
<widget class="QListWidget" name="listWidget">
24+
<item>
25+
<property name="text">
26+
<string>新建项目</string>
27+
</property>
28+
</item>
29+
<item>
30+
<property name="text">
31+
<string>新建项目</string>
32+
</property>
33+
</item>
34+
<item>
35+
<property name="text">
36+
<string>新建项目</string>
37+
</property>
38+
</item>
39+
<item>
40+
<property name="text">
41+
<string>新建项目</string>
42+
</property>
43+
</item>
44+
</widget>
45+
<widget class="QTreeWidget" name="treeWidget">
46+
<column>
47+
<property name="text">
48+
<string>1</string>
49+
</property>
50+
</column>
51+
<column>
52+
<property name="text">
53+
<string>新建列</string>
54+
</property>
55+
</column>
56+
<column>
57+
<property name="text">
58+
<string>新建列</string>
59+
</property>
60+
</column>
61+
<column>
62+
<property name="text">
63+
<string>新建列</string>
64+
</property>
65+
</column>
66+
<item>
67+
<property name="text">
68+
<string>新建项目</string>
69+
</property>
70+
</item>
71+
<item>
72+
<property name="text">
73+
<string>新建项目</string>
74+
</property>
75+
</item>
76+
<item>
77+
<property name="text">
78+
<string>新建项目</string>
79+
</property>
80+
</item>
81+
<item>
82+
<property name="text">
83+
<string>新建项目</string>
84+
</property>
85+
</item>
86+
</widget>
87+
</widget>
88+
</item>
89+
</layout>
90+
</widget>
91+
<widget class="QMenuBar" name="menuBar">
92+
<property name="geometry">
93+
<rect>
94+
<x>0</x>
95+
<y>0</y>
96+
<width>600</width>
97+
<height>23</height>
98+
</rect>
99+
</property>
100+
</widget>
101+
<widget class="QToolBar" name="mainToolBar">
102+
<attribute name="toolBarArea">
103+
<enum>TopToolBarArea</enum>
104+
</attribute>
105+
<attribute name="toolBarBreak">
106+
<bool>false</bool>
107+
</attribute>
108+
</widget>
109+
<widget class="QStatusBar" name="statusBar"/>
110+
</widget>
111+
<layoutdefault spacing="6" margin="11"/>
112+
<customwidgets>
113+
<customwidget>
114+
<class>MySplitter</class>
115+
<extends>QSplitter</extends>
116+
<header>mysplitter.h</header>
117+
<container>1</container>
118+
</customwidget>
119+
</customwidgets>
120+
<resources>
121+
<include location="SpliterRubberBand.qrc"/>
122+
</resources>
123+
<connections/>
124+
</ui>

0 commit comments

Comments
 (0)