├── QTImageDisplay ├── qtimagedisplay.qrc ├── main.cpp ├── qclicklabel.hpp ├── qclicklabel.cpp ├── GeneratedFiles │ ├── qrc_qtimagedisplay.cpp │ └── ui_qtimagedisplay.h ├── qtimagedisplay.ui ├── qtimagedisplay.h ├── QTImageDisplay.vcxproj.filters ├── qtimagedisplay.cpp └── QTImageDisplay.vcxproj ├── QTImageDisplay.sln ├── .gitattributes ├── .gitignore ├── README.md └── LICENSE /QTImageDisplay/qtimagedisplay.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /QTImageDisplay/main.cpp: -------------------------------------------------------------------------------- 1 | #include "qtimagedisplay.h" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication a(argc, argv); 7 | QTImageDisplay w; 8 | w.show(); 9 | return a.exec(); 10 | } 11 | -------------------------------------------------------------------------------- /QTImageDisplay/qclicklabel.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | class QClickLabel : public QLabel { 8 | Q_OBJECT 9 | signals : 10 | void MouseRelease(QMouseEvent *evt); 11 | void KeyPressed(QKeyEvent *evt); 12 | void MouseMoved(QMouseEvent* evt); 13 | void MousePressed(QMouseEvent* evt); 14 | void MouseDoubliClick(QMouseEvent* evt); 15 | void WheelEvent(QWheelEvent* evt); 16 | 17 | public: 18 | QClickLabel(QWidget * parent = Q_NULLPTR): QLabel(parent) 19 | {} 20 | ~QClickLabel(); 21 | 22 | protected: 23 | void mouseReleaseEvent(QMouseEvent*); // listen to mouse event 24 | void mousePressEvent(QMouseEvent*); // listen to mouse event 25 | void mouseMoveEvent(QMouseEvent*); // listen to mouse event 26 | void keyPressEvent(QKeyEvent *); // listen to key press event 27 | void mouseDoubleClickEvent(QMouseEvent *event); 28 | void wheelEvent(QWheelEvent *event); 29 | 30 | }; 31 | -------------------------------------------------------------------------------- /QTImageDisplay/qclicklabel.cpp: -------------------------------------------------------------------------------- 1 | #include "qclicklabel.hpp" 2 | 3 | // destructor 4 | QClickLabel::~QClickLabel() { 5 | 6 | } 7 | 8 | 9 | void QClickLabel::mouseReleaseEvent(QMouseEvent *evt) 10 | { 11 | qDebug() << "in function ClickedLabel mouse release" << endl; 12 | emit MouseRelease(evt); 13 | } 14 | 15 | 16 | void QClickLabel::keyPressEvent(QKeyEvent *evt) { 17 | // listen to key press event 18 | qDebug() << "in function ClickedLabel key press" << endl; 19 | emit KeyPressed(evt); 20 | } 21 | 22 | 23 | void QClickLabel::mouseMoveEvent(QMouseEvent *event) { 24 | qDebug() << "in function mouseMoveEvent" << endl; 25 | emit MouseMoved(event); 26 | } 27 | 28 | 29 | void QClickLabel::mousePressEvent(QMouseEvent *event) { 30 | qDebug() << "in function mousePressEvent" << endl; 31 | emit MousePressed(event); 32 | } 33 | 34 | 35 | void QClickLabel::mouseDoubleClickEvent(QMouseEvent *event) { 36 | qDebug() << "in function mouseDoubleClickEvent" << endl; 37 | emit MouseDoubliClick(event); 38 | } 39 | 40 | void QClickLabel::wheelEvent(QWheelEvent *event) { 41 | qDebug() << "in function wheelEvent" << endl; 42 | emit WheelEvent(event); 43 | } 44 | 45 | -------------------------------------------------------------------------------- /QTImageDisplay.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QTImageDisplay", "QTImageDisplay\QTImageDisplay.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.ActiveCfg = Debug|x64 17 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.Build.0 = Debug|x64 18 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x86.ActiveCfg = Debug|Win32 19 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x86.Build.0 = Debug|Win32 20 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.ActiveCfg = Release|x64 21 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.Build.0 = Release|x64 22 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x86.ActiveCfg = Release|Win32 23 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /QTImageDisplay/GeneratedFiles/qrc_qtimagedisplay.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Resource object code 3 | ** 4 | ** Created by: The Resource Compiler for Qt version 5.6.2 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #ifdef QT_NAMESPACE 10 | # define QT_RCC_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name 11 | # define QT_RCC_MANGLE_NAMESPACE0(x) x 12 | # define QT_RCC_MANGLE_NAMESPACE1(a, b) a##_##b 13 | # define QT_RCC_MANGLE_NAMESPACE2(a, b) QT_RCC_MANGLE_NAMESPACE1(a,b) 14 | # define QT_RCC_MANGLE_NAMESPACE(name) QT_RCC_MANGLE_NAMESPACE2( \ 15 | QT_RCC_MANGLE_NAMESPACE0(name), QT_RCC_MANGLE_NAMESPACE0(QT_NAMESPACE)) 16 | #else 17 | # define QT_RCC_PREPEND_NAMESPACE(name) name 18 | # define QT_RCC_MANGLE_NAMESPACE(name) name 19 | #endif 20 | 21 | #ifdef QT_NAMESPACE 22 | namespace QT_NAMESPACE { 23 | #endif 24 | 25 | #ifdef QT_NAMESPACE 26 | } 27 | #endif 28 | 29 | int QT_RCC_MANGLE_NAMESPACE(qInitResources_qtimagedisplay)(); 30 | int QT_RCC_MANGLE_NAMESPACE(qInitResources_qtimagedisplay)() 31 | { 32 | return 1; 33 | } 34 | 35 | int QT_RCC_MANGLE_NAMESPACE(qCleanupResources_qtimagedisplay)(); 36 | int QT_RCC_MANGLE_NAMESPACE(qCleanupResources_qtimagedisplay)() 37 | { 38 | return 1; 39 | } 40 | 41 | namespace { 42 | struct initializer { 43 | initializer() { QT_RCC_MANGLE_NAMESPACE(qInitResources_qtimagedisplay)(); } 44 | ~initializer() { QT_RCC_MANGLE_NAMESPACE(qCleanupResources_qtimagedisplay)(); } 45 | } dummy; 46 | } 47 | -------------------------------------------------------------------------------- /QTImageDisplay/qtimagedisplay.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | QTImageDisplayClass 4 | 5 | 6 | 7 | 0 8 | 0 9 | 600 10 | 850 11 | 12 | 13 | 14 | QTImageDisplay 15 | 16 | 17 | 18 | 19 | 20 | 0 21 | 0 22 | 601 23 | 791 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 0 35 | 0 36 | 600 37 | 17 38 | 39 | 40 | 41 | 42 | file 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | TopToolBarArea 52 | 53 | 54 | false 55 | 56 | 57 | 58 | 59 | 60 | open image file 61 | 62 | 63 | 64 | 65 | exit 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /QTImageDisplay/qtimagedisplay.h: -------------------------------------------------------------------------------- 1 | #ifndef QTIMAGEDISPLAY_H 2 | #define QTIMAGEDISPLAY_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include "ui_qtimagedisplay.h" 14 | #include "qclicklabel.hpp" 15 | 16 | 17 | class QTImageDisplay : public QMainWindow 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | QTImageDisplay(QWidget *parent = 0); 23 | ~QTImageDisplay(); 24 | 25 | 26 | QClickLabel * qclicklabel; 27 | QAction *action_open_img_file; 28 | QAction *action_exit; 29 | 30 | 31 | // class variable 32 | int i_show_image_label_width; 33 | int i_show_image_label_height; 34 | 35 | // image show start x, start y 36 | int i_show_image_start_x; 37 | int i_show_image_start_y; 38 | 39 | // image zoom in ratio 40 | float f_iamge_ratio_x; 41 | float f_iamge_ratio_y; 42 | 43 | // zoom parameter 44 | float f_zoom_step; 45 | float f_zoom_ratio_max; 46 | float f_zoom_ratio_min; 47 | float f_zoom_current_scale; 48 | 49 | 50 | // QImage front image pointer 51 | QImage* qimage_front_image; 52 | bool b_is_front_image_opened; 53 | 54 | // bool variable 55 | bool is_translate_image; 56 | int i_mouse_last_position_x; 57 | int i_mouse_last_position_y; 58 | int i_mouse_new_position_x; 59 | int i_mouse_new_position_y; 60 | bool b_mouse_right_button_clicked; 61 | bool b_mouse_left_button_clicked; 62 | 63 | //************************************** 64 | //functions 65 | //************************************** 66 | void show_image(); 67 | void translate_image(); 68 | 69 | // 10:51 70 | 71 | 72 | private: 73 | Ui::QTImageDisplayClass ui; 74 | 75 | 76 | private slots: 77 | // slots 78 | void slot_open_img_file(); 79 | void slot_qclicklabel_wheel_move(QWheelEvent* evt); 80 | // used to select edge point and translate image 81 | void slot_qclicklabel_mouse_press(QMouseEvent* evt); 82 | void slot_qclicklabel_mouse_move(QMouseEvent* evt); 83 | void slot_qclicklabel_mouse_release(QMouseEvent* evt); 84 | }; 85 | 86 | #endif // QTIMAGEDISPLAY_H 87 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /QTImageDisplay/QTImageDisplay.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;cxx;c;def 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h 11 | 12 | 13 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3} 14 | ui 15 | 16 | 17 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 18 | qrc;* 19 | false 20 | 21 | 22 | {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} 23 | moc;h;cpp 24 | False 25 | 26 | 27 | {56394526-b7d9-42c7-bd66-c5ab5c3f3649} 28 | cpp;moc 29 | False 30 | 31 | 32 | {539527b9-a4bf-4d7b-a821-03f7e66d6d3c} 33 | cpp;moc 34 | False 35 | 36 | 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Generated Files\Debug 46 | 47 | 48 | Generated Files\Release 49 | 50 | 51 | Generated Files 52 | 53 | 54 | Header Files 55 | 56 | 57 | Generated Files\Debug 58 | 59 | 60 | Generated Files\Release 61 | 62 | 63 | 64 | 65 | Header Files 66 | 67 | 68 | Form Files 69 | 70 | 71 | Resource Files 72 | 73 | 74 | Header Files 75 | 76 | 77 | 78 | 79 | Generated Files 80 | 81 | 82 | -------------------------------------------------------------------------------- /QTImageDisplay/GeneratedFiles/ui_qtimagedisplay.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'qtimagedisplay.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.6.2 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_QTIMAGEDISPLAY_H 10 | #define UI_QTIMAGEDISPLAY_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "qclicklabel.hpp" 25 | 26 | QT_BEGIN_NAMESPACE 27 | 28 | class Ui_QTImageDisplayClass 29 | { 30 | public: 31 | QAction *actionOpen_iamge_file; 32 | QAction *actionExit; 33 | QWidget *centralWidget; 34 | QClickLabel *label; 35 | QMenuBar *menuBar; 36 | QMenu *menuFile; 37 | QToolBar *mainToolBar; 38 | QStatusBar *statusBar; 39 | 40 | void setupUi(QMainWindow *QTImageDisplayClass) 41 | { 42 | if (QTImageDisplayClass->objectName().isEmpty()) 43 | QTImageDisplayClass->setObjectName(QStringLiteral("QTImageDisplayClass")); 44 | QTImageDisplayClass->resize(600, 850); 45 | actionOpen_iamge_file = new QAction(QTImageDisplayClass); 46 | actionOpen_iamge_file->setObjectName(QStringLiteral("actionOpen_iamge_file")); 47 | actionExit = new QAction(QTImageDisplayClass); 48 | actionExit->setObjectName(QStringLiteral("actionExit")); 49 | centralWidget = new QWidget(QTImageDisplayClass); 50 | centralWidget->setObjectName(QStringLiteral("centralWidget")); 51 | label = new QClickLabel(centralWidget); 52 | label->setObjectName(QStringLiteral("label")); 53 | label->setGeometry(QRect(0, 0, 601, 791)); 54 | QTImageDisplayClass->setCentralWidget(centralWidget); 55 | menuBar = new QMenuBar(QTImageDisplayClass); 56 | menuBar->setObjectName(QStringLiteral("menuBar")); 57 | menuBar->setGeometry(QRect(0, 0, 600, 17)); 58 | menuFile = new QMenu(menuBar); 59 | menuFile->setObjectName(QStringLiteral("menuFile")); 60 | QTImageDisplayClass->setMenuBar(menuBar); 61 | mainToolBar = new QToolBar(QTImageDisplayClass); 62 | mainToolBar->setObjectName(QStringLiteral("mainToolBar")); 63 | QTImageDisplayClass->addToolBar(Qt::TopToolBarArea, mainToolBar); 64 | statusBar = new QStatusBar(QTImageDisplayClass); 65 | statusBar->setObjectName(QStringLiteral("statusBar")); 66 | QTImageDisplayClass->setStatusBar(statusBar); 67 | 68 | menuBar->addAction(menuFile->menuAction()); 69 | menuFile->addAction(actionOpen_iamge_file); 70 | menuFile->addAction(actionExit); 71 | 72 | retranslateUi(QTImageDisplayClass); 73 | 74 | QMetaObject::connectSlotsByName(QTImageDisplayClass); 75 | } // setupUi 76 | 77 | void retranslateUi(QMainWindow *QTImageDisplayClass) 78 | { 79 | QTImageDisplayClass->setWindowTitle(QApplication::translate("QTImageDisplayClass", "QTImageDisplay", 0)); 80 | actionOpen_iamge_file->setText(QApplication::translate("QTImageDisplayClass", "open image file", 0)); 81 | actionExit->setText(QApplication::translate("QTImageDisplayClass", "exit", 0)); 82 | label->setText(QString()); 83 | menuFile->setTitle(QApplication::translate("QTImageDisplayClass", "file", 0)); 84 | } // retranslateUi 85 | 86 | }; 87 | 88 | namespace Ui { 89 | class QTImageDisplayClass: public Ui_QTImageDisplayClass {}; 90 | } // namespace Ui 91 | 92 | QT_END_NAMESPACE 93 | 94 | #endif // UI_QTIMAGEDISPLAY_H 95 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | [Xx]64/ 19 | [Xx]86/ 20 | [Bb]uild/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | *.sap 90 | 91 | # TFS 2012 Local Workspace 92 | $tf/ 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | *.DotSettings.user 101 | 102 | # JustCode is a .NET coding add-in 103 | .JustCode 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | _NCrunch_* 113 | .*crunch*.local.xml 114 | nCrunchTemp_* 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | 143 | # TODO: Un-comment the next line if you do not want to checkin 144 | # your web deploy settings because they may include unencrypted 145 | # passwords 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # NuGet Packages 150 | *.nupkg 151 | # The packages folder can be ignored because of Package Restore 152 | **/packages/* 153 | # except build/, which is used as an MSBuild target. 154 | !**/packages/build/ 155 | # Uncomment if necessary however generally it will be regenerated when needed 156 | #!**/packages/repositories.config 157 | # NuGet v3's project.json files produces more ignoreable files 158 | *.nuget.props 159 | *.nuget.targets 160 | 161 | # Microsoft Azure Build Output 162 | csx/ 163 | *.build.csdef 164 | 165 | # Microsoft Azure Emulator 166 | ecf/ 167 | rcf/ 168 | 169 | # Windows Store app package directory 170 | AppPackages/ 171 | BundleArtifacts/ 172 | 173 | # Visual Studio cache files 174 | # files ending in .cache can be ignored 175 | *.[Cc]ache 176 | # but keep track of directories ending in .cache 177 | !*.[Cc]ache/ 178 | 179 | # Others 180 | ClientBin/ 181 | [Ss]tyle[Cc]op.* 182 | ~$* 183 | *~ 184 | *.dbmdl 185 | *.dbproj.schemaview 186 | *.pfx 187 | *.publishsettings 188 | node_modules/ 189 | orleans.codegen.cs 190 | 191 | # RIA/Silverlight projects 192 | Generated_Code/ 193 | 194 | # Backup & report files from converting an old project file 195 | # to a newer Visual Studio version. Backup files are not needed, 196 | # because we have git ;-) 197 | _UpgradeReport_Files/ 198 | Backup*/ 199 | UpgradeLog*.XML 200 | UpgradeLog*.htm 201 | 202 | # SQL Server files 203 | *.mdf 204 | *.ldf 205 | 206 | # Business Intelligence projects 207 | *.rdl.data 208 | *.bim.layout 209 | *.bim_*.settings 210 | 211 | # Microsoft Fakes 212 | FakesAssemblies/ 213 | 214 | # GhostDoc plugin setting file 215 | *.GhostDoc.xml 216 | 217 | # Node.js Tools for Visual Studio 218 | .ntvs_analysis.dat 219 | 220 | # Visual Studio 6 build log 221 | *.plg 222 | 223 | # Visual Studio 6 workspace options file 224 | *.opt 225 | 226 | # Visual Studio LightSwitch build output 227 | **/*.HTMLClient/GeneratedArtifacts 228 | **/*.DesktopClient/GeneratedArtifacts 229 | **/*.DesktopClient/ModelManifest.xml 230 | **/*.Server/GeneratedArtifacts 231 | **/*.Server/ModelManifest.xml 232 | _Pvt_Extensions 233 | 234 | # LightSwitch generated files 235 | GeneratedArtifacts/ 236 | ModelManifest.xml 237 | 238 | # Paket dependency manager 239 | .paket/paket.exe 240 | 241 | # FAKE - F# Make 242 | .fake/ 243 | -------------------------------------------------------------------------------- /QTImageDisplay/qtimagedisplay.cpp: -------------------------------------------------------------------------------- 1 | #include "qtimagedisplay.h" 2 | 3 | QTImageDisplay::QTImageDisplay(QWidget *parent) 4 | : QMainWindow(parent) 5 | { 6 | // 1. set 7 | ui.setupUi(this); 8 | //set fix size 9 | setFixedSize(600, 850); 10 | 11 | 12 | // 2. get the widget pointer 13 | qclicklabel = ui.label; 14 | action_open_img_file = ui.actionOpen_iamge_file; 15 | action_exit = ui.actionExit; 16 | 17 | // 3. initiate the widget 18 | qclicklabel->setAutoFillBackground(true); // enable us can change the background 19 | QPalette label_palette = qclicklabel->palette(); 20 | label_palette.setColor(QPalette::Window, Qt::lightGray); //change the background 21 | qclicklabel->setPalette(label_palette); 22 | qclicklabel->setEnabled(true); 23 | 24 | // get the width and height 25 | i_show_image_label_width = qclicklabel->width(); 26 | i_show_image_label_height = qclicklabel->height(); 27 | 28 | // start x, start y 29 | i_show_image_start_x = 0; 30 | i_show_image_start_y = 0; 31 | 32 | // image scale ratio 33 | f_iamge_ratio_x = 1.0f; 34 | f_iamge_ratio_y = 1.0f; 35 | 36 | // zoom parameter 37 | f_zoom_step = 0.5; 38 | f_zoom_ratio_max = 4; 39 | f_zoom_ratio_min = 1; 40 | f_zoom_current_scale = 1.0; 41 | 42 | // image translate 43 | b_mouse_left_button_clicked = false; 44 | b_mouse_right_button_clicked = false; 45 | 46 | // 4. connect signals and slots 47 | connect(action_open_img_file, SIGNAL(triggered()), this, SLOT(slot_open_img_file())); 48 | connect(action_exit, SIGNAL(triggered()), this, SLOT(close())); 49 | connect(qclicklabel, SIGNAL(MouseMoved(QMouseEvent *)), this, SLOT(slot_qclicklabel_mouse_move(QMouseEvent *))); 50 | connect(qclicklabel, SIGNAL(MousePressed(QMouseEvent *)), this, SLOT(slot_qclicklabel_mouse_press(QMouseEvent *))); 51 | connect(qclicklabel, SIGNAL(MouseRelease(QMouseEvent *)), this, SLOT(slot_qclicklabel_mouse_release(QMouseEvent *))); 52 | connect(qclicklabel, SIGNAL(WheelEvent(QWheelEvent *)), this, SLOT(slot_qclicklabel_wheel_move(QWheelEvent*))); 53 | 54 | 55 | 56 | } 57 | 58 | // wheel to zoom in and zoom out 59 | void QTImageDisplay::slot_qclicklabel_wheel_move(QWheelEvent* evt) { 60 | 61 | // get the delta 62 | float f_degree_delta = evt->delta()*1.0 / 640; 63 | 64 | // case1 : front image opened 65 | if (b_is_front_image_opened) { 66 | 67 | // zoom in and zoom out 68 | // update scale ratio 69 | if (f_zoom_current_scale + f_degree_delta > f_zoom_ratio_max || f_zoom_current_scale + f_degree_delta < f_zoom_ratio_min) { 70 | return; 71 | } 72 | f_zoom_current_scale += f_degree_delta; 73 | f_iamge_ratio_x = qimage_front_image->width()*1.0 / (f_zoom_current_scale*qclicklabel->width()); 74 | f_iamge_ratio_y = qimage_front_image->height()*1.0 / (f_zoom_current_scale*qclicklabel->height()); 75 | 76 | // show image 77 | show_image(); 78 | } 79 | } 80 | 81 | 82 | // show front image 83 | void QTImageDisplay::show_image() { 84 | 85 | // test if qimage_front_image is not opened 86 | if (qimage_front_image == NULL) { 87 | return; 88 | } 89 | 90 | // show image 91 | QImage qimage_temp = qimage_front_image->copy(); 92 | 93 | // judge if the start_x or start_y is legal 94 | if (i_show_image_start_x + qclicklabel->width() > qclicklabel->width()*f_zoom_current_scale) { 95 | i_show_image_start_x = qclicklabel->width()*f_zoom_current_scale - qclicklabel->width() - 1; 96 | } 97 | if (i_show_image_start_y + qclicklabel->height() > qclicklabel->height()*f_zoom_current_scale) { 98 | i_show_image_start_y = qclicklabel->height()*f_zoom_current_scale - qclicklabel->height() - 1; 99 | } 100 | 101 | QImage * qimage_scaled = new QImage; 102 | *qimage_scaled = qimage_temp.scaled(QSize(qclicklabel->width()*f_zoom_current_scale, qclicklabel->height()*f_zoom_current_scale), Qt::IgnoreAspectRatio).copy(i_show_image_start_x, i_show_image_start_y, qclicklabel->width(), qclicklabel->height()); 103 | qclicklabel->setPixmap(QPixmap::fromImage(*qimage_scaled)); 104 | delete qimage_scaled; 105 | 106 | } 107 | 108 | 109 | // open front image 110 | void QTImageDisplay::slot_open_img_file() { 111 | 112 | QString str_slected_image = QFileDialog::getOpenFileName(this, 113 | tr("select image file"), 114 | ".//", 115 | tr("Image (*.png *.jpg *.xpm)")); 116 | 117 | // front image pointer 118 | qimage_front_image = new QImage(); 119 | if (!str_slected_image.isEmpty()) { 120 | 121 | // validate the image is correctly opened 122 | if (!(qimage_front_image->load(str_slected_image))) { 123 | 124 | QMessageBox::information(this, 125 | tr("info"), 126 | tr("open image fail!")); 127 | delete qimage_front_image; 128 | return; 129 | } 130 | 131 | 132 | // record the image scale ration x,y 133 | f_iamge_ratio_x = qimage_front_image->width()*1.0 / qclicklabel->width(); 134 | f_iamge_ratio_y = qimage_front_image->height()*1.0 / qclicklabel->height(); 135 | 136 | 137 | // get a image copy and show the image 138 | QImage qimage_temp = qimage_front_image->copy(); 139 | 140 | QImage * qimage_scaled = new QImage; 141 | *qimage_scaled = qimage_temp.scaled(QSize(qclicklabel->width(), qclicklabel->height()), Qt::IgnoreAspectRatio); 142 | qclicklabel->setPixmap(QPixmap::fromImage(*qimage_scaled)); 143 | delete qimage_scaled; 144 | 145 | // change status 146 | b_is_front_image_opened = true; 147 | 148 | // reset parameters about show image 149 | f_zoom_current_scale = 1; 150 | // start x, start y 151 | i_show_image_start_x = 0; 152 | i_show_image_start_y = 0; 153 | 154 | 155 | } 156 | else { 157 | // log out information 158 | QMessageBox::information(this, 159 | tr("info"), 160 | tr("you select no file!")); 161 | } 162 | 163 | } 164 | 165 | 166 | 167 | // used to select edge point and translate image 168 | void QTImageDisplay::slot_qclicklabel_mouse_press(QMouseEvent* evt) { 169 | 170 | // case1 : front image is opened 171 | if (b_is_front_image_opened) { 172 | // select edge point 173 | if (evt->button() == Qt::LeftButton) { 174 | 175 | b_mouse_left_button_clicked = true; 176 | }else if (evt->button() == Qt::RightButton) { 177 | // translate image 178 | b_mouse_right_button_clicked = true; 179 | i_mouse_last_position_x = evt->localPos().x(); 180 | i_mouse_last_position_y = evt->localPos().y(); 181 | } 182 | } 183 | } 184 | 185 | void QTImageDisplay::slot_qclicklabel_mouse_move(QMouseEvent* evt) { 186 | 187 | // case 1: front image is opened; 188 | if (b_is_front_image_opened) { 189 | if (b_mouse_right_button_clicked) { 190 | i_mouse_new_position_x = evt->localPos().x(); 191 | i_mouse_new_position_y = evt->localPos().y(); 192 | translate_image(); 193 | } 194 | } 195 | } 196 | 197 | // translate front image 198 | void QTImageDisplay::translate_image() { 199 | // 200 | int i_distance = (i_mouse_new_position_x - i_mouse_last_position_x)*(i_mouse_new_position_x - i_mouse_last_position_x) + (i_mouse_new_position_y - i_mouse_last_position_y)*(i_mouse_new_position_y - i_mouse_last_position_y); 201 | if (i_distance < 50) { 202 | return; 203 | } 204 | 205 | // compute the delta 206 | int i_delta_x = -1 * (i_mouse_new_position_x - i_mouse_last_position_x); 207 | int i_delta_y = -1 * (i_mouse_new_position_y - i_mouse_last_position_y); 208 | 209 | 210 | // start x exceeds the left edge 211 | if (i_show_image_start_x + i_delta_x < 0) { 212 | i_show_image_start_x = 0; 213 | 214 | } 215 | else if (i_show_image_start_x + i_delta_x + qclicklabel->width() > int(f_zoom_current_scale*qclicklabel->width() - 1)) { 216 | //start x exceeds the right edge 217 | i_show_image_start_x = int(f_zoom_current_scale*qclicklabel->width() - qclicklabel->width()); 218 | } 219 | else { 220 | i_show_image_start_x += i_delta_x; 221 | } 222 | 223 | // start y exceeds the top edge 224 | if (i_show_image_start_y + i_delta_y < 0) { 225 | i_show_image_start_y = 0; 226 | 227 | } 228 | else if (i_show_image_start_y + i_delta_y + qclicklabel->height() > int(f_zoom_current_scale*qclicklabel->height() - 1)) { 229 | //start y exceeds the bottom edge 230 | i_show_image_start_y = int(f_zoom_current_scale*qclicklabel->height() - qclicklabel->height()); 231 | } 232 | else { 233 | i_show_image_start_y += i_delta_y; 234 | } 235 | 236 | // update the mouse last position 237 | i_mouse_last_position_x = i_mouse_new_position_x; 238 | i_mouse_last_position_y = i_mouse_new_position_y; 239 | 240 | // show image 241 | show_image(); 242 | } 243 | 244 | 245 | //mouse wheel move event 246 | void QTImageDisplay::slot_qclicklabel_mouse_release(QMouseEvent* evt) { 247 | 248 | //change the flag 249 | if (evt->button() == Qt::LeftButton) { 250 | b_mouse_left_button_clicked = false; 251 | } 252 | else if (evt->button() == Qt::RightButton) { 253 | b_mouse_right_button_clicked = false; 254 | } 255 | } 256 | 257 | 258 | 259 | QTImageDisplay::~QTImageDisplay() 260 | { 261 | 262 | 263 | 264 | } 265 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### [QT]- VS2015+QT5.6.2展示图片,支持放大、缩小、和移动图片 2 | 3 | 本文主要介绍,如何使用在VS2015平台上集成QT环境实现一个控件(Widget),该控件可以展示图片,并且该支持滚动鼠标中间放大缩小图片,右键移动鼠标进行图片的拖动。本文将从以下几个部分进行描述: 4 | 1. 将QT集成到VS2015平台 5 | 2. 自定义控件描述 6 | 3. 图片放大、缩小、移动的实现 7 | 4. 工程效果 8 | 5. 总结 9 | ------ 10 | #### 一、 将QT集成到VS2015平台 11 |
12 | 主要过程:安装QT、配置环境、和安装vs2015插件。在开源社区的一篇博客描述得很清楚,在这里不赘述了。[点此跳转到该博客](https://my.oschina.net/jthmath/blog/640227) 13 | 14 | #### 二、 自定以控件描述 15 |
16 | 在QT当中没有专门用来展示图片的控件,通常用于展示图片的控件是QLabel,但是该控件不支持图片的缩放移动等功能,所以就自定义一个控件,使其支持上述功能。 17 | 先上代码: 18 | 19 | **qclicklabel.hpp**: 20 | ```c++ 21 | #pragma once 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | class QClickLabel : public QLabel { 28 | Q_OBJECT 29 | signals : 30 | void MouseRelease(QMouseEvent *evt); 31 | void KeyPressed(QKeyEvent *evt); 32 | void MouseMoved(QMouseEvent* evt); 33 | void MousePressed(QMouseEvent* evt); 34 | void MouseDoubliClick(QMouseEvent* evt); 35 | void WheelEvent(QWheelEvent* evt); 36 | 37 | public: 38 | QClickLabel(QWidget * parent = Q_NULLPTR): QLabel(parent) 39 | {} 40 | ~QClickLabel(); 41 | 42 | protected: 43 | void mouseReleaseEvent(QMouseEvent*); // listen to mouse event 44 | void mousePressEvent(QMouseEvent*); // listen to mouse event 45 | void mouseMoveEvent(QMouseEvent*); // listen to mouse event 46 | void keyPressEvent(QKeyEvent *); // listen to key press event 47 | void mouseDoubleClickEvent(QMouseEvent *event); 48 | void wheelEvent(QWheelEvent *event); 49 | 50 | }; 51 | ``` 52 | QClickLabel继承于QLabel,该控件能够支持鼠标的点击、移动、释放、双击、和中键滚动事件(代码protected部分定义);同时该控件能够发射出相应的信号(代码signals处定义) 53 | 54 |
55 | 56 | **qclicklabel.cpp**: 57 | ```c++ 58 | #include "qclicklabel.hpp" 59 | 60 | // destructor 61 | QClickLabel::~QClickLabel() { 62 | 63 | } 64 | 65 | 66 | void QClickLabel::mouseReleaseEvent(QMouseEvent *evt) 67 | { 68 | qDebug() << "in function ClickedLabel mouse release" << endl; 69 | emit MouseRelease(evt); 70 | } 71 | 72 | 73 | void QClickLabel::keyPressEvent(QKeyEvent *evt) { 74 | // listen to key press event 75 | qDebug() << "in function ClickedLabel key press" << endl; 76 | emit KeyPressed(evt); 77 | } 78 | 79 | 80 | void QClickLabel::mouseMoveEvent(QMouseEvent *event) { 81 | qDebug() << "in function mouseMoveEvent" << endl; 82 | emit MouseMoved(event); 83 | } 84 | 85 | 86 | void QClickLabel::mousePressEvent(QMouseEvent *event) { 87 | qDebug() << "in function mousePressEvent" << endl; 88 | emit MousePressed(event); 89 | } 90 | 91 | 92 | void QClickLabel::mouseDoubleClickEvent(QMouseEvent *event) { 93 | qDebug() << "in function mouseDoubleClickEvent" << endl; 94 | emit MouseDoubliClick(event); 95 | } 96 | 97 | void QClickLabel::wheelEvent(QWheelEvent *event) { 98 | qDebug() << "in function wheelEvent" << endl; 99 | emit WheelEvent(event); 100 | } 101 | ``` 102 | 在**qclicklabel.cpp**实现部分,控件接收到任何鼠标事件,都发送相应的信号出去,以便在主程序当中做出相应的操作。 103 | 104 | 105 | #### 三、 图片放大、缩小、移动的实现 106 |
107 | 108 | 在自定以的控件当中,由于控件可以直接获取到鼠标事件,并且根据获取到的鼠标事件发出相应的信号,所以在主程序当中,我们只需要监听监听该控件,如果发出信号A,就做出相应的操作。 109 | 110 | **图片放大和缩小:** 111 | 在此工程的实现中,加载到内存当中的图片都是以横纵铺满的方式展示在qlabel中,如下图所示 112 | ![图 1 展示图片](http://upload-images.jianshu.io/upload_images/1769441-41ccea0d7eaae114.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 113 | 114 |
115 | 116 | 此时展示的图片的宽高就和qlabel控件的宽高一致了,所以原图片的宽高`o_img_width,o_img_height`和qclicklabel的宽高 `show_width, show_height`会有一个比值 `ratio_o_2_show_width,ratio_o_2_show_height`。 117 | 此时,图片刚刚导入展示时图片的放大的倍数-scale为1(宽高扩大的倍数相同),鼠标的中键滚动,只需要改变这个scale在大于1的一个合理的范围,然后先将图片的宽高通过QImage里面的方法转换到`show_width*scale, show_height*scale`,然后将图片的`Rect(show_start_x, show_start_y, show_width, show_height)`-起点为`(show_start 118 | _x, show_start_y)`,宽高分别为`show_width, show_height`的长方形,此时的`show_start_x, show_start_y`都为0部分展示出来既可以实现图片的放大缩小了。 119 | 120 | 响应鼠标滚动事件的槽 121 | ```c++ 122 | // wheel to zoom in and zoom out 123 | void QTImageDisplay::slot_qclicklabel_wheel_move(QWheelEvent* evt) { 124 | 125 | // get the delta 126 | float f_degree_delta = evt->delta()*1.0 / 640; 127 | 128 | // case1 : front image opened 129 | if (b_is_front_image_opened) { 130 | 131 | // zoom in and zoom out 132 | // update scale ratio 133 | if (f_zoom_current_scale + f_degree_delta > f_zoom_ratio_max || f_zoom_current_scale + f_degree_delta < f_zoom_ratio_min) { 134 | return; 135 | } 136 | f_zoom_current_scale += f_degree_delta; 137 | f_iamge_ratio_x = qimage_front_image->width()*1.0 / (f_zoom_current_scale*qclicklabel->width()); 138 | f_iamge_ratio_y = qimage_front_image->height()*1.0 / (f_zoom_current_scale*qclicklabel->height()); 139 | 140 | // show image 141 | show_image(); 142 | } 143 | } 144 | ``` 145 | 146 | show_image()函数实现 147 | ```c++ 148 | // show front image 149 | void QTImageDisplay::show_image() { 150 | 151 | // test if qimage_front_image is not opened 152 | if (qimage_front_image == NULL) { 153 | return; 154 | } 155 | 156 | // show image 157 | QImage qimage_temp = qimage_front_image->copy(); 158 | 159 | // judge if the start_x or start_y is legal 160 | if (i_show_image_start_x + qclicklabel->width() > qclicklabel->width()*f_zoom_current_scale) { 161 | i_show_image_start_x = qclicklabel->width()*f_zoom_current_scale - qclicklabel->width() - 1; 162 | } 163 | if (i_show_image_start_y + qclicklabel->height() > qclicklabel->height()*f_zoom_current_scale) { 164 | i_show_image_start_y = qclicklabel->height()*f_zoom_current_scale - qclicklabel->height() - 1; 165 | } 166 | 167 | QImage * qimage_scaled = new QImage; 168 | *qimage_scaled = qimage_temp.scaled(QSize(qclicklabel->width()*f_zoom_current_scale, qclicklabel->height()*f_zoom_current_scale), Qt::IgnoreAspectRatio).copy(i_show_image_start_x, i_show_image_start_y, qclicklabel->width(), qclicklabel->height()); 169 | qclicklabel->setPixmap(QPixmap::fromImage(*qimage_scaled)); 170 | delete qimage_scaled; 171 | 172 | } 173 | ``` 174 | 175 |
176 | 177 | **图片移动:** 178 | 在图片的移动过程中,需要使用到三个鼠标事件:鼠标单击事件、鼠标移动事件,鼠标释放事件。 179 | 在鼠标单击事件当中,我们需要记录此时点击的是鼠标的左键还是右键(用两个private variable保存该状态,代码如下所示),并且当右键点击时,需要记录此时鼠标的位置,为了后面移动图片的需求; 180 | ```c++ 181 | // used to select edge point and translate image 182 | void QTImageDisplay::slot_qclicklabel_mouse_press(QMouseEvent* evt) { 183 | 184 | if (b_is_front_image_opened) { 185 | // select edge point 186 | if (evt->button() == Qt::LeftButton) { 187 | 188 | b_mouse_left_button_clicked = true; 189 | }else if (evt->button() == Qt::RightButton) { 190 | // translate image 191 | b_mouse_right_button_clicked = true; 192 | i_mouse_last_position_x = evt->localPos().x(); 193 | i_mouse_last_position_y = evt->localPos().y(); 194 | } 195 | } 196 | } 197 | ``` 198 | 199 | 在鼠标移动事件当中,由于我们设置的是右键单击然后移动鼠标进行图片的移动,所以在此,我们只需要处理右键被点击时的事件,此时记录鼠标移动后的所在的新的位置,然后交由translate_image()去移动图片,并且展示,该函数主要是通过鼠标的原始位置和鼠标最新位置的差值来更新`show_start_x,show_start_y`,并且判断此时的要展示的`Rect(show_start_x,show_start_y,show_width,show_height)`是否超出了边界; 200 | ```c++ 201 | void QTImageDisplay::slot_qclicklabel_mouse_move(QMouseEvent* evt) { 202 | 203 | // case 1: front image is opened; 204 | if (b_is_front_image_opened) { 205 | if (b_mouse_right_button_clicked) { 206 | i_mouse_new_position_x = evt->localPos().x(); 207 | i_mouse_new_position_y = evt->localPos().y(); 208 | translate_image(); 209 | } 210 | } 211 | } 212 | 213 | // translate front image 214 | void QTImageDisplay::translate_image() { 215 | // 216 | int i_distance = (i_mouse_new_position_x - i_mouse_last_position_x)*(i_mouse_new_position_x - i_mouse_last_position_x) + (i_mouse_new_position_y - i_mouse_last_position_y)*(i_mouse_new_position_y - i_mouse_last_position_y); 217 | if (i_distance < 50) { 218 | return; 219 | } 220 | 221 | // compute the delta 222 | int i_delta_x = -1 * (i_mouse_new_position_x - i_mouse_last_position_x); 223 | int i_delta_y = -1 * (i_mouse_new_position_y - i_mouse_last_position_y); 224 | 225 | 226 | // start x exceeds the left edge 227 | if (i_show_image_start_x + i_delta_x < 0) { 228 | i_show_image_start_x = 0; 229 | 230 | } 231 | else if (i_show_image_start_x + i_delta_x + qclicklabel->width() > int(f_zoom_current_scale*qclicklabel->width() - 1)) { 232 | //start x exceeds the right edge 233 | i_show_image_start_x = int(f_zoom_current_scale*qclicklabel->width() - qclicklabel->width()); 234 | } 235 | else { 236 | i_show_image_start_x += i_delta_x; 237 | } 238 | 239 | // start y exceeds the top edge 240 | if (i_show_image_start_y + i_delta_y < 0) { 241 | i_show_image_start_y = 0; 242 | 243 | } 244 | else if (i_show_image_start_y + i_delta_y + qclicklabel->height() > int(f_zoom_current_scale*qclicklabel->height() - 1)) { 245 | //start y exceeds the bottom edge 246 | i_show_image_start_y = int(f_zoom_current_scale*qclicklabel->height() - qclicklabel->height()); 247 | } 248 | else { 249 | i_show_image_start_y += i_delta_y; 250 | } 251 | 252 | // update the mouse last position 253 | i_mouse_last_position_x = i_mouse_new_position_x; 254 | i_mouse_last_position_y = i_mouse_new_position_y; 255 | 256 | // show image 257 | show_image(); 258 | } 259 | ``` 260 | 在鼠标释放事件当中,需要恢复记录鼠标的点击状态的两个private variable,代码如下所示: 261 | 262 | ```c++ 263 | //mouse wheel move event 264 | void QTImageDisplay::slot_qclicklabel_mouse_release(QMouseEvent* evt) { 265 | 266 | //change the flag 267 | if (evt->button() == Qt::LeftButton) { 268 | b_mouse_left_button_clicked = false; 269 | } 270 | else if (evt->button() == Qt::RightButton) { 271 | b_mouse_right_button_clicked = false; 272 | } 273 | } 274 | ``` 275 | 276 | 至此,图片的移动也就实现了。 277 | 278 | 279 | #### 四、 工程效果 280 |
281 | 282 | 283 | ![图 2 效果图](http://upload-images.jianshu.io/upload_images/1769441-598a07ac8097bfa0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 284 | 285 | #### 五、 总结 286 | 本文只是展示了作者在实现展示图片控件的一个思路,但是还不够完美,比如可以多设置几种展示的方式,比如居中,适应宽度,适应高度,宽高独立放大缩小等等。不过如果你对于本文描述的实现方式能够理解,那么上述的一些功能只需要根据自己工程的需求去私人定制就好了。 287 | 288 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /QTImageDisplay/QTImageDisplay.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {B12702AD-ABFB-343A-A199-8E24837244A3} 23 | Qt4VSv1.0 24 | 25 | 26 | 27 | Application 28 | v140 29 | 30 | 31 | Application 32 | v140 33 | 34 | 35 | Application 36 | v140 37 | 38 | 39 | Application 40 | v140 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | <_ProjectFileVersion>14.0.25431.1 62 | 63 | 64 | $(SolutionDir)$(Platform)\$(Configuration)\ 65 | 66 | 67 | $(SolutionDir)$(Platform)\$(Configuration)\ 68 | 69 | 70 | $(SolutionDir)$(Platform)\$(Configuration)\ 71 | 72 | 73 | $(SolutionDir)$(Platform)\$(Configuration)\ 74 | 75 | 76 | 77 | UNICODE;WIN32;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions) 78 | .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories) 79 | Disabled 80 | ProgramDatabase 81 | MultiThreadedDebugDLL 82 | true 83 | 84 | 85 | Windows 86 | $(OutDir)\$(ProjectName).exe 87 | $(QTDIR)\lib;%(AdditionalLibraryDirectories) 88 | true 89 | qtmaind.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Widgetsd.lib;%(AdditionalDependencies) 90 | 91 | 92 | 93 | 94 | UNICODE;WIN32;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions) 95 | .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories) 96 | Disabled 97 | ProgramDatabase 98 | MultiThreadedDebugDLL 99 | true 100 | 101 | 102 | Windows 103 | $(OutDir)\$(ProjectName).exe 104 | $(QTDIR)\lib;%(AdditionalLibraryDirectories) 105 | true 106 | qtmaind.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Widgetsd.lib;%(AdditionalDependencies) 107 | 108 | 109 | 110 | 111 | UNICODE;WIN32;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions) 112 | .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories) 113 | 114 | MultiThreadedDLL 115 | true 116 | 117 | 118 | Windows 119 | $(OutDir)\$(ProjectName).exe 120 | $(QTDIR)\lib;%(AdditionalLibraryDirectories) 121 | false 122 | qtmain.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Widgets.lib;%(AdditionalDependencies) 123 | 124 | 125 | 126 | 127 | UNICODE;WIN32;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions) 128 | .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories) 129 | 130 | MultiThreadedDLL 131 | true 132 | 133 | 134 | Windows 135 | $(OutDir)\$(ProjectName).exe 136 | $(QTDIR)\lib;%(AdditionalLibraryDirectories) 137 | false 138 | qtmain.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Widgets.lib;%(AdditionalDependencies) 139 | 140 | 141 | 142 | 143 | true 144 | true 145 | 146 | 147 | true 148 | true 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | true 162 | true 163 | 164 | 165 | true 166 | true 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | $(QTDIR)\bin\moc.exe;%(FullPath) 175 | Moc%27ing qtimagedisplay.h... 176 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp 177 | "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" 178 | $(QTDIR)\bin\moc.exe;%(FullPath) 179 | Moc%27ing qtimagedisplay.h... 180 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp 181 | "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D_CRT_SECURE_NO_WARNINGS -D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" 182 | $(QTDIR)\bin\moc.exe;%(FullPath) 183 | Moc%27ing qtimagedisplay.h... 184 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp 185 | "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" 186 | $(QTDIR)\bin\moc.exe;%(FullPath) 187 | Moc%27ing qtimagedisplay.h... 188 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp 189 | "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D_CRT_SECURE_NO_WARNINGS -D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" 190 | 191 | 192 | 193 | 194 | $(QTDIR)\bin\uic.exe;%(AdditionalInputs) 195 | Uic%27ing %(Identity)... 196 | .\GeneratedFiles\ui_%(Filename).h;%(Outputs) 197 | "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" 198 | $(QTDIR)\bin\uic.exe;%(AdditionalInputs) 199 | Uic%27ing %(Identity)... 200 | .\GeneratedFiles\ui_%(Filename).h;%(Outputs) 201 | "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" 202 | $(QTDIR)\bin\uic.exe;%(AdditionalInputs) 203 | Uic%27ing %(Identity)... 204 | .\GeneratedFiles\ui_%(Filename).h;%(Outputs) 205 | "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" 206 | $(QTDIR)\bin\uic.exe;%(AdditionalInputs) 207 | Uic%27ing %(Identity)... 208 | .\GeneratedFiles\ui_%(Filename).h;%(Outputs) 209 | "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" 210 | 211 | 212 | 213 | 214 | 215 | $(QTDIR)\bin\moc.exe;%(FullPath) 216 | Moc%27ing qclicklabel.hpp... 217 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp 218 | "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" 219 | $(QTDIR)\bin\moc.exe;%(FullPath) 220 | Moc%27ing qclicklabel.hpp... 221 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp 222 | "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D_CRT_SECURE_NO_WARNINGS -D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" 223 | $(QTDIR)\bin\moc.exe;%(FullPath) 224 | Moc%27ing qclicklabel.hpp... 225 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp 226 | "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" 227 | $(QTDIR)\bin\moc.exe;%(FullPath) 228 | Moc%27ing qclicklabel.hpp... 229 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp 230 | "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D_CRT_SECURE_NO_WARNINGS -D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWidgets" 231 | 232 | 233 | 234 | 235 | %(FullPath);%(AdditionalInputs) 236 | Rcc%27ing %(Identity)... 237 | .\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) 238 | "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp 239 | %(FullPath);%(AdditionalInputs) 240 | Rcc%27ing %(Identity)... 241 | .\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) 242 | "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp 243 | %(FullPath);%(AdditionalInputs) 244 | Rcc%27ing %(Identity)... 245 | .\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) 246 | "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp 247 | %(FullPath);%(AdditionalInputs) 248 | Rcc%27ing %(Identity)... 249 | .\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) 250 | "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | --------------------------------------------------------------------------------