├── cmake ├── jkqtextras_lib_properties.cmake ├── jkqtextras_common_include.cmake ├── jkqtextras_common_qtsettings.cmake ├── jkqtextras_dumpallvariables.cmake ├── jkqtextras_common_compilersettings.cmake ├── jkqtextras_deployqt.cmake └── jkqtextras_cmake_options.cmake ├── lib ├── jkqtextras │ ├── images │ │ ├── exec.svgz │ │ ├── star.png │ │ ├── btn_down.png │ │ ├── btn_up.png │ │ ├── darkstar.png │ │ ├── execute.png │ │ ├── fileopen.png │ │ ├── network.png │ │ ├── nostar.png │ │ ├── fileopen.svgz │ │ ├── fileselect.png │ │ ├── openfolder.png │ │ ├── smallstar.png │ │ ├── statusDone.png │ │ ├── statusNone.png │ │ ├── execute_hover.png │ │ ├── network_hover.png │ │ ├── smalldarkstar.png │ │ ├── statusDone.svgz │ │ ├── statusFailed.png │ │ ├── statusFailed.svgz │ │ ├── statusNone.svgz │ │ ├── urltoolbutton.png │ │ ├── execute_active.png │ │ ├── fileopen_active.png │ │ ├── fileopen_hover.png │ │ ├── network_active.png │ │ ├── execute_disabled.png │ │ ├── executetoolbutton.png │ │ ├── fileopen_disabled.png │ │ ├── fileselect_active.png │ │ ├── fileselect_hover.png │ │ ├── network_disabled.png │ │ ├── statusInProgress.png │ │ ├── statusInProgress.svgz │ │ ├── statusNotStarted.png │ │ ├── statusNotStarted.svgz │ │ ├── dirselecttoolbutton.png │ │ ├── fileselect_disabled.png │ │ └── fileselecttoolbutton.png │ ├── jkqtedoubleedit.qrc │ ├── jkqtestarratingwidget.qrc │ ├── jkqtespecialtoolbutton.qrc │ ├── jkqteprogresslistwidget.qrc │ ├── jkqtecolorsampler.cpp │ ├── jkqteverticalscrollarea.cpp │ ├── jkqteverticalscrollarea.h │ ├── jkqteenhancedcombobox.cpp │ ├── jkqtecolorsampler.h │ ├── jkqteenhancedcombobox.h │ ├── jkqtecheckablestringlistmodel.h │ ├── jkqterecentfilesmenu.h │ ├── jkqtextras_imexport.h │ ├── jkqtecheckablestringlistmodel.cpp │ ├── jkqtevisiblehandlesplitter.h │ ├── jkqtestarratingwidget.h │ ├── jkqtestarratingwidget.cpp │ ├── CMakeLists.txt │ ├── jkqtevisiblehandlesplitter.cpp │ ├── jkqterecentfilesmenu.cpp │ ├── jkqtespecialtoolbutton.cpp │ ├── jkqtespecialtoolbutton.h │ ├── jkqteprogresslistwidget.h │ ├── jkqtecolorslider.h │ ├── jkqtedoubleedit.h │ ├── jkqteprogresslistwidget.cpp │ └── jkqtedoubleedit.cpp ├── jkqtextras.pri ├── README.md ├── jkqtextras_version.h.in └── CMakeLists.txt ├── screenshots ├── JKQTEDoubleEdit.png ├── jkqtextras_test.png ├── JKQTEColorSampler.png ├── JKQTEColorSlider.png ├── JKQTEColorSlider_Hue.png ├── JKQTEColorSlider_Red.png ├── JKQTEDoubleEdit_logo.png ├── JKQTERecentFilesMenu.png ├── JKQTEColorSampler_logo.png ├── JKQTEColorSlider_Blue.png ├── JKQTEColorSlider_Green.png ├── JKQTEColorSlider_Grey.png ├── JKQTEColorSlider_Value.png ├── JKQTEColorSlider_logo.png ├── JKQTEEnhancedComboBox.png ├── JKQTEProgressListDialog.png ├── JKQTEProgressListWidget.png ├── JKQTEStarRatingWidget.png ├── JKQTEURLOpenToolButton.png ├── jkqtextras_test_small.png ├── JKQTEColorSliderRGBGroup.png ├── JKQTEColorSliderVertical.png ├── JKQTEFileSelectToolButton.png ├── JKQTEModernProgressDialog.png ├── JKQTEModernProgressWidget.png ├── JKQTERecentFilesMenu_logo.png ├── JKQTEColorSliderHorizontal.png ├── JKQTEColorSlider_Saturation.png ├── JKQTEEnhancedComboBox_logo.png ├── JKQTEFileExecuteToolButton.png ├── JKQTEProgressListDialog_logo.png ├── JKQTEProgressListWidget_logo.png ├── JKQTEStarRatingWidget_logo.png ├── JKQTEURLOpenToolButton_logo.png ├── JKQTEVisibleHandleSplitter.png ├── JKQTECheckableStringListModel.png ├── JKQTEColorSlider_Transparency.png ├── JKQTEDirectorySelectToolButton.png ├── JKQTEFileSelectToolButton_logo.png ├── JKQTEModernProgressDialog_logo.png ├── JKQTEModernProgressWidget_Pie.png ├── JKQTEModernProgressWidget_Ring.png ├── JKQTEModernProgressWidget_logo.png ├── JKQTEStarRatingWidget_rating0.png ├── JKQTEStarRatingWidget_rating5.png ├── JKQTEColorSampler_CircleSampler.png ├── JKQTEFileExecuteToolButton_logo.png ├── JKQTEModernProgressWidget_NoText.png ├── JKQTEModernProgressWidget_Strokes.png ├── JKQTEModernProgressWidget_circles.png ├── JKQTEVisibleHandleSplitterHover.png ├── JKQTEVisibleHandleSplitter_logo.png ├── JKQTECheckableStringListModel_logo.png ├── JKQTEColorSampler_RectangleSampler.png ├── JKQTEDirectorySelectToolButton_logo.png ├── JKQTEModernProgressWidget_ValueText.png ├── JKQTEModernProgressWidget_GradientRing.png ├── JKQTEModernProgressWidget_PercentText.png ├── JKQTEStarRatingWidget_rating3 - Kopie.png ├── JKQTEColorSlider_FixedColorCircleIndicator.png ├── JKQTEModernProgressWidget_NoInnerIndicator.png ├── JKQTEModernProgressWidget_RoundedStrokeRing.png ├── JKQTEColorSlider_SelectedColorCircleIndicator.png ├── JKQTEColorSlider_FixedColorDoubleArrowIndicator.png ├── JKQTEColorSlider_SelectedColorDoubleArrowIndicator.png ├── JKQTEModernProgressWidget_InnerProgressBarHorizontal.png ├── JKQTEModernProgressWidget_InnerProgressFillHorizontal.png └── JKQTEModernProgressWidget_InnerProgressFillVertical.png ├── ci ├── test_travis.sh └── install_travis.sh ├── examples ├── jkqtextras_test │ ├── jkqtextras_test_and_lib.pro │ ├── jkqtextras_test.cpp │ ├── README.md │ ├── jkqtextras_test.pro │ ├── testmainwindow.h │ ├── CMakeLists.txt │ └── testmainwindow.ui ├── CMakeLists.txt └── README.md ├── qmake ├── staticlib │ ├── jkqtplotterlib.pro │ └── README.md └── sharedlib │ ├── jkqtextraslib.pro │ └── README.md ├── JKQtExtrasBuildAllExamples.pro ├── doc ├── dox │ ├── examples_and_tutorials.dox │ ├── jkqtextras.dox │ ├── whatsnew.dox │ ├── mainpage.dox │ ├── gallery.dox │ └── buildinstructions.dox ├── template_verbatimgraph.txt └── jkqtplotter_stylesheet.css ├── readme.txt.in ├── CMakeLists.txt ├── .gitignore ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── README.md └── appveyor.yml /cmake/jkqtextras_lib_properties.cmake: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cmake/jkqtextras_common_include.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1) 2 | 3 | include(jkqtextras_deployqt) 4 | -------------------------------------------------------------------------------- /lib/jkqtextras/images/exec.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/exec.svgz -------------------------------------------------------------------------------- /lib/jkqtextras/images/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/star.png -------------------------------------------------------------------------------- /screenshots/JKQTEDoubleEdit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEDoubleEdit.png -------------------------------------------------------------------------------- /screenshots/jkqtextras_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/jkqtextras_test.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/btn_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/btn_down.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/btn_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/btn_up.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/darkstar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/darkstar.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/execute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/execute.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/fileopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/fileopen.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/network.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/nostar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/nostar.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSampler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSampler.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/fileopen.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/fileopen.svgz -------------------------------------------------------------------------------- /lib/jkqtextras/images/fileselect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/fileselect.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/openfolder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/openfolder.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/smallstar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/smallstar.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/statusDone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/statusDone.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/statusNone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/statusNone.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider_Hue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider_Hue.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider_Red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider_Red.png -------------------------------------------------------------------------------- /screenshots/JKQTEDoubleEdit_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEDoubleEdit_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTERecentFilesMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTERecentFilesMenu.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/execute_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/execute_hover.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/network_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/network_hover.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/smalldarkstar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/smalldarkstar.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/statusDone.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/statusDone.svgz -------------------------------------------------------------------------------- /lib/jkqtextras/images/statusFailed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/statusFailed.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/statusFailed.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/statusFailed.svgz -------------------------------------------------------------------------------- /lib/jkqtextras/images/statusNone.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/statusNone.svgz -------------------------------------------------------------------------------- /lib/jkqtextras/images/urltoolbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/urltoolbutton.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSampler_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSampler_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider_Blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider_Blue.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider_Green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider_Green.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider_Grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider_Grey.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider_Value.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider_Value.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTEEnhancedComboBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEEnhancedComboBox.png -------------------------------------------------------------------------------- /screenshots/JKQTEProgressListDialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEProgressListDialog.png -------------------------------------------------------------------------------- /screenshots/JKQTEProgressListWidget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEProgressListWidget.png -------------------------------------------------------------------------------- /screenshots/JKQTEStarRatingWidget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEStarRatingWidget.png -------------------------------------------------------------------------------- /screenshots/JKQTEURLOpenToolButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEURLOpenToolButton.png -------------------------------------------------------------------------------- /screenshots/jkqtextras_test_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/jkqtextras_test_small.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/execute_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/execute_active.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/fileopen_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/fileopen_active.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/fileopen_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/fileopen_hover.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/network_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/network_active.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSliderRGBGroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSliderRGBGroup.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSliderVertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSliderVertical.png -------------------------------------------------------------------------------- /screenshots/JKQTEFileSelectToolButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEFileSelectToolButton.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressDialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressDialog.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget.png -------------------------------------------------------------------------------- /screenshots/JKQTERecentFilesMenu_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTERecentFilesMenu_logo.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/execute_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/execute_disabled.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/executetoolbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/executetoolbutton.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/fileopen_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/fileopen_disabled.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/fileselect_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/fileselect_active.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/fileselect_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/fileselect_hover.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/network_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/network_disabled.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/statusInProgress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/statusInProgress.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/statusInProgress.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/statusInProgress.svgz -------------------------------------------------------------------------------- /lib/jkqtextras/images/statusNotStarted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/statusNotStarted.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/statusNotStarted.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/statusNotStarted.svgz -------------------------------------------------------------------------------- /screenshots/JKQTEColorSliderHorizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSliderHorizontal.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider_Saturation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider_Saturation.png -------------------------------------------------------------------------------- /screenshots/JKQTEEnhancedComboBox_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEEnhancedComboBox_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTEFileExecuteToolButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEFileExecuteToolButton.png -------------------------------------------------------------------------------- /screenshots/JKQTEProgressListDialog_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEProgressListDialog_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTEProgressListWidget_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEProgressListWidget_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTEStarRatingWidget_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEStarRatingWidget_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTEURLOpenToolButton_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEURLOpenToolButton_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTEVisibleHandleSplitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEVisibleHandleSplitter.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/dirselecttoolbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/dirselecttoolbutton.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/fileselect_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/fileselect_disabled.png -------------------------------------------------------------------------------- /lib/jkqtextras/images/fileselecttoolbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/lib/jkqtextras/images/fileselecttoolbutton.png -------------------------------------------------------------------------------- /screenshots/JKQTECheckableStringListModel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTECheckableStringListModel.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider_Transparency.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider_Transparency.png -------------------------------------------------------------------------------- /screenshots/JKQTEDirectorySelectToolButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEDirectorySelectToolButton.png -------------------------------------------------------------------------------- /screenshots/JKQTEFileSelectToolButton_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEFileSelectToolButton_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressDialog_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressDialog_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_Pie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_Pie.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_Ring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_Ring.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTEStarRatingWidget_rating0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEStarRatingWidget_rating0.png -------------------------------------------------------------------------------- /screenshots/JKQTEStarRatingWidget_rating5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEStarRatingWidget_rating5.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSampler_CircleSampler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSampler_CircleSampler.png -------------------------------------------------------------------------------- /screenshots/JKQTEFileExecuteToolButton_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEFileExecuteToolButton_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_NoText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_NoText.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_Strokes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_Strokes.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_circles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_circles.png -------------------------------------------------------------------------------- /screenshots/JKQTEVisibleHandleSplitterHover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEVisibleHandleSplitterHover.png -------------------------------------------------------------------------------- /screenshots/JKQTEVisibleHandleSplitter_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEVisibleHandleSplitter_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTECheckableStringListModel_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTECheckableStringListModel_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSampler_RectangleSampler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSampler_RectangleSampler.png -------------------------------------------------------------------------------- /screenshots/JKQTEDirectorySelectToolButton_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEDirectorySelectToolButton_logo.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_ValueText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_ValueText.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_GradientRing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_GradientRing.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_PercentText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_PercentText.png -------------------------------------------------------------------------------- /screenshots/JKQTEStarRatingWidget_rating3 - Kopie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEStarRatingWidget_rating3 - Kopie.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider_FixedColorCircleIndicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider_FixedColorCircleIndicator.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_NoInnerIndicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_NoInnerIndicator.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_RoundedStrokeRing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_RoundedStrokeRing.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider_SelectedColorCircleIndicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider_SelectedColorCircleIndicator.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider_FixedColorDoubleArrowIndicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider_FixedColorDoubleArrowIndicator.png -------------------------------------------------------------------------------- /screenshots/JKQTEColorSlider_SelectedColorDoubleArrowIndicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEColorSlider_SelectedColorDoubleArrowIndicator.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_InnerProgressBarHorizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_InnerProgressBarHorizontal.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_InnerProgressFillHorizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_InnerProgressFillHorizontal.png -------------------------------------------------------------------------------- /screenshots/JKQTEModernProgressWidget_InnerProgressFillVertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkriege2/JKQtExtras/HEAD/screenshots/JKQTEModernProgressWidget_InnerProgressFillVertical.png -------------------------------------------------------------------------------- /ci/test_travis.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Exit on error 4 | set -e 5 | # Echo each command 6 | set -x 7 | 8 | mkdir build 9 | cd build 10 | cmake -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX .. 11 | cmake --build . --target install 12 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtedoubleedit.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/btn_down.png 4 | images/btn_up.png 5 | 6 | 7 | -------------------------------------------------------------------------------- /cmake/jkqtextras_common_qtsettings.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Instruct CMake to run moc+rcc+uic automatically when needed. 3 | set(CMAKE_AUTOMOC ON) 4 | set(CMAKE_AUTORCC ON) 5 | set(CMAKE_AUTOUIC ON) 6 | 7 | find_package(Qt5 5.0 REQUIRED Core Gui Widgets PrintSupport Svg Xml OpenGL) 8 | -------------------------------------------------------------------------------- /lib/jkqtextras.pri: -------------------------------------------------------------------------------- 1 | isEmpty(JKQTEXTRAS_PRI_INCLUDED) { 2 | JKQTEXTRAS_PRI_INCLUDED = 1 3 | 4 | INCLUDEPATH += $PWD 5 | 6 | 7 | HEADERS += \ 8 | 9 | 10 | 11 | SOURCES += \ 12 | 13 | 14 | 15 | RESOURCES += 16 | 17 | QT += xml svg opengl 18 | 19 | } 20 | -------------------------------------------------------------------------------- /examples/jkqtextras_test/jkqtextras_test_and_lib.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += jkqtextraslib jkqtextras_test 4 | 5 | jkqtextraslib.file = ../../qmake/staticlib/jkqtextraslib/jkqtextraslib.pro 6 | 7 | jkqtextras_test.file=$$PWD/jkqtextras_test.pro 8 | jkqtextras_test.depends = jkqtextraslib 9 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtestarratingwidget.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/star.png 4 | images/darkstar.png 5 | images/nostar.png 6 | 7 | 8 | -------------------------------------------------------------------------------- /qmake/staticlib/jkqtplotterlib.pro: -------------------------------------------------------------------------------- 1 | TARGET = jkqtextraslib 2 | CONFIG (debug, debug|release): TARGET = jkqtextraslib_debug 3 | 4 | TEMPLATE = lib 5 | CONFIG += staticlib 6 | CONFIG += create_prl 7 | 8 | include(../../lib/jkqtextras.pri) 9 | 10 | win32-msvc*: DEFINES += _USE_MATH_DEFINES 11 | win32-msvc*: DEFINES += NOMINMAX 12 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | message( STATUS ) 4 | message( STATUS "............................................................................." ) 5 | message( STATUS ".. BUILDING EXAMPLES" ) 6 | message( STATUS "............................................................................." ) 7 | 8 | add_subdirectory(jkqtextras_test) 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /JKQtExtrasBuildAllExamples.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += jkqtextraslib \ 4 | jkqtextraslib_sharedlib 5 | 6 | 7 | jkqtextraslib.file = qmake/staticlib/jkqtextraslib/jkqtextraslib.pro 8 | jkqtextraslib_sharedlib.file = qmake/sharedlib/jkqtextraslib/jkqtextraslib.pro 9 | 10 | jkqtextras_test.file = examples/jkqtextras_test/jkqtextras_test.pro 11 | jkqtextras_test.depends = jkqtextraslib 12 | -------------------------------------------------------------------------------- /doc/dox/examples_and_tutorials.dox: -------------------------------------------------------------------------------- 1 | /*! 2 | \page exampleTutorialProjects Example & Tutorial Projects 3 | 4 | This section assembles some simple examples of usage. 5 | 6 | 7 | 8 | 9 |
Screenshot Description Notes 10 |
\image html jkqtextras_test_small.png 11 | \subpage JKQTExtrasTest 12 | demonstrates all widgets in this library 13 |
14 | 15 | */ -------------------------------------------------------------------------------- /examples/jkqtextras_test/jkqtextras_test.cpp: -------------------------------------------------------------------------------- 1 | /** \example jkqtextras_test.cpp 2 | * Showcases the widgets in JKQtExtras 3 | * 4 | * \ref JKQTExtrasTest 5 | */ 6 | 7 | #include 8 | #include "testmainwindow.h" 9 | 10 | int main(int argc, char* argv[]) 11 | { 12 | QApplication app(argc, argv); 13 | 14 | TestMainWindow win; 15 | 16 | win.show(); 17 | 18 | return app.exec(); 19 | } 20 | -------------------------------------------------------------------------------- /qmake/sharedlib/jkqtextraslib.pro: -------------------------------------------------------------------------------- 1 | TARGET = jkqtextraslib 2 | CONFIG (debug, debug|release): TARGET = jkqtextraslib_debug 3 | 4 | TEMPLATE = lib 5 | CONFIG += dll 6 | CONFIG += create_prl 7 | 8 | win32 { 9 | DEFINES += JKQTEXTRAS_LIB_IN_DLL 10 | DEFINES += JKQTEXTRAS_LIB_EXPORT_LIBRARY 11 | } 12 | 13 | win32-msvc*: DEFINES += _USE_MATH_DEFINES 14 | win32-msvc*: DEFINES += NOMINMAX 15 | 16 | 17 | include(../../lib/jkqtextras.pri) 18 | -------------------------------------------------------------------------------- /doc/template_verbatimgraph.txt: -------------------------------------------------------------------------------- 1 | \verbatim 2 | colval 3 | ^ 4 | | 5 | 250 - 6 | | 7 | 200 - 8 | | 9 | 150 - 10 | | 11 | 100 - 12 | | 13 | 50 - 14 | | 15 | 0 - 16 | | 17 | ---|----|----|----|----|----|----|----|----|----|----|--> position 18 | 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 19 | \endverbatim 20 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtespecialtoolbutton.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/executetoolbutton.png 4 | images/fileselecttoolbutton.png 5 | images/dirselecttoolbutton.png 6 | images/urltoolbutton.png 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqteprogresslistwidget.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/statusDone.png 4 | images/statusFailed.png 5 | images/statusInProgress.png 6 | images/statusNotStarted.png 7 | images/statusNone.png 8 | 9 | 10 | -------------------------------------------------------------------------------- /cmake/jkqtextras_dumpallvariables.cmake: -------------------------------------------------------------------------------- 1 | function(jkqtextras_dumpallvariables) 2 | get_cmake_property(_variableNames VARIABLES) 3 | list (SORT _variableNames) 4 | foreach (_variableName ${_variableNames}) 5 | if (ARGV0) 6 | unset(MATCHED) 7 | string(REGEX MATCH ${ARGV0} MATCHED ${_variableName}) 8 | if (NOT MATCHED) 9 | continue() 10 | endif() 11 | endif() 12 | message(STATUS "${_variableName}=${${_variableName}}") 13 | endforeach() 14 | endfunction(jkqtextras_dumpallvariables) -------------------------------------------------------------------------------- /examples/jkqtextras_test/README.md: -------------------------------------------------------------------------------- 1 | # Example (JKQtExtras) {#JKQTExtrasTest} 2 | This project (see [`jkqtextras_test`](https://github.com/jkriege2/JKQtExtras/tree/master/examples/jkqtextras_test) showcases the widgets in this library. 3 | 4 | The source code of the main application is (see [`jkqtextras_test.cpp`](https://github.com/jkriege2/JKQtExtras/tree/master/examples/jkqtextras_test/jkqtextras_test.cpp): 5 | ```.cpp 6 | ``` 7 | The result looks like this: 8 | 9 | ![jkqtextras_test](https://raw.githubusercontent.com/jkriege2/JKQtExtras/master/screenshots/jkqtextras_test.png) 10 | 11 | 12 | -------------------------------------------------------------------------------- /cmake/jkqtextras_common_compilersettings.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1) 2 | 3 | # configure compiler 4 | set(CMAKE_CXX_STANDARD 11) 5 | set(CMAKE_CXX_STANDARD_REQUIRED on) 6 | 7 | if(MINGW) 8 | # COMPILER-SETTINGS FOR MINGW 9 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") 10 | elseif(MSVC) 11 | # COMPILER-SETTINGS FOR MS VISUAL C++ 12 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") 13 | # To fix error: C2338: va_start argument must not 14 | # have reference type and must not be parenthesized 15 | add_definitions(/D_CRT_NO_VA_START_VALIDATION) 16 | add_definitions(/DNOMINMAX) 17 | endif() 18 | 19 | if(NOT APPLE) 20 | set(CMAKE_INSTALL_RPATH $ORIGIN) 21 | endif() 22 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Example (JKQtExtras): Examples & Tutorials {#exampleProjectsTutorials} 2 | This section assembles some simple examples of usage. 3 | You can find more (complex) examples for the classes in this repository in the subfolder "test". 4 | All test-projects are Qt-projects that use qmake to build. You can load them into QtCreator easily. 5 | 6 | ## Different Plot Data Styles 7 | 8 | | Screenshot | Description | Notes | 9 | |:-------------:| ------------- | ------------- | 10 | | [![](https://raw.githubusercontent.com/jkriege2/JKQtExtras/master/screenshots/jkqtextras_test_small.png)](https://github.com/jkriege2/JKQtExtras/tree/master/examples/jkqtextras_test/README.md) | [Example](https://github.com/jkriege2/JKQtExtras/tree/master/examples/jkqtextras_test/README.md) | | 11 | -------------------------------------------------------------------------------- /examples/jkqtextras_test/jkqtextras_test.pro: -------------------------------------------------------------------------------- 1 | # source code for this simple demo 2 | SOURCES = barchart.cpp 3 | 4 | # configure Qt 5 | CONFIG += link_prl qt 6 | QT += core gui xml svg 7 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport 8 | 9 | # output executable name 10 | TARGET = barchart 11 | 12 | # include jkqtextras source code 13 | DEPENDPATH += ../../lib ../../qmake/staticlib/jkqtextraslib 14 | INCLUDEPATH += ../../lib 15 | CONFIG (debug, debug|release) { 16 | LIBS += -L../../qmake/staticlib/jkqtextraslib/debug -ljkqtextraslib_debug 17 | } else { 18 | LIBS += -L../../qmake/staticlib/jkqtextraslib/release -ljkqtextraslib 19 | } 20 | message("LIBS = $$LIBS") 21 | 22 | 23 | win32-msvc*: DEFINES += _USE_MATH_DEFINES 24 | win32-msvc*: DEFINES += NOMINMAX 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /lib/README.md: -------------------------------------------------------------------------------- 1 | # JKQtExtras: LIB subdirectory 2 | 3 | This directory contains all files that belong to the JKQTExtras library. There are several ways to add these to your program: 4 | 5 | ### simply include all necessary files 6 | If you use QMake and simply want to include all necessary files into your project, include one of these `PRI`-files into your QMake Project: 7 | - `jkqtextras.pri` contains all files in this library 8 | 9 | ### Build static libraries 10 | In the directory [`../staticlib`](../staticlib) you will find several Project files that build a static library of the full JKQtExtras. You can then link against these libs in your project. 11 | 12 | ### Build shared libraries (DLLs, SOs, ...) 13 | In the directory [`../sharedlib`](../sharedlib) you will find several Project files that build a dynamic shared library of the full JKQtExtras. You can then link against these libs in your project. 14 | 15 | -------------------------------------------------------------------------------- /examples/jkqtextras_test/testmainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTMAINWINDOW_H 2 | #define TESTMAINWINDOW_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class TestMainWindow; 9 | } 10 | 11 | class TestMainWindow : public QMainWindow 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit TestMainWindow(QWidget *parent = nullptr); 17 | ~TestMainWindow(); 18 | protected: 19 | QWidget *testVisibleHandleSplitter(); 20 | QWidget *testJKQTEProgressListWidget(); 21 | QWidget *testJKQTEModernProgressWidget(); 22 | QWidget *testJKQTEColorSlider(); 23 | QWidget *testMiscellanious(); 24 | QWidget *testJKQTEDoubleEdit(); 25 | QWidget *testJKQTECheckableStringListModel(); 26 | private: 27 | Ui::TestMainWindow *ui; 28 | QTimer* timJKQTEProgressListWidget; 29 | int stateJKQTEProgressListWidget; 30 | QTimer* timJKQTEProgressListDialog; 31 | int stateJKQTEProgressListDialog; 32 | }; 33 | 34 | #endif // TESTMAINWINDOW_H 35 | -------------------------------------------------------------------------------- /examples/jkqtextras_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | set(EXAMPLE_NAME jkqtextras_test) 4 | set(EXENAME ${EXAMPLE_NAME}) 5 | 6 | message( STATUS ".. Building Example ${EXAMPLE_NAME}" ) 7 | 8 | 9 | # Set up source files 10 | set(SOURCES 11 | jkqtextras_test.cpp 12 | testmainwindow.cpp 13 | ) 14 | set(HEADERS 15 | testmainwindow.h 16 | ) 17 | set(RESOURCES ) 18 | set(UIS 19 | testmainwindow.ui 20 | ) 21 | 22 | add_executable(${EXENAME} WIN32 ${SOURCES} ${HEADERS} ${RESOURCES} ${UIS}) 23 | target_include_directories(${EXENAME} PRIVATE ../../lib) 24 | if(JKQtExtras_BUILD_STATIC_LIBS) 25 | target_link_libraries(${EXENAME} JKQtExtrasLib) 26 | elseif(JKQtExtras_BUILD_SHARED_LIBS) 27 | target_link_libraries(${EXENAME} JKQtExtrasSharedLib) 28 | endif() 29 | 30 | 31 | 32 | # Installation 33 | install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 34 | 35 | #Installation of Qt DLLs on Windows 36 | jkqtextras_deployqt(${EXENAME}) 37 | -------------------------------------------------------------------------------- /doc/dox/jkqtextras.dox: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | 4 | \defgroup JKQtExtras JKQtExtras: A Collection of Useful Qt Qidgets and Tools 5 | 6 | \defgroup JKQtExtrasWidgets JKQtExtras: Widgets 7 | \ingroup JKQtExtras 8 | 9 | \defgroup JKQtExtrasWidgetsLayout Form Organization/Layout 10 | \ingroup JKQtExtrasWidgets 11 | 12 | \defgroup JKQtExtrasWidgetsMenus Menus, ... 13 | \ingroup JKQtExtrasWidgets 14 | 15 | \defgroup JKQtExtrasWidgetsProgress Progress Indicators 16 | \ingroup JKQtExtrasWidgets 17 | 18 | \defgroup JKQtExtrasWidgetsEdits Edit Fields 19 | \ingroup JKQtExtrasWidgets 20 | 21 | \defgroup JKQtExtrasWidgetsLabels Labels, Image Views, ... 22 | \ingroup JKQtExtrasWidgets 23 | 24 | \defgroup JKQtExtrasWidgetsSliders Sliders ... 25 | \ingroup JKQtExtrasWidgets 26 | 27 | \defgroup JKQtExtrasWidgetsButtons Buttons ... 28 | \ingroup JKQtExtrasWidgets 29 | 30 | \defgroup JKQtExtrasToolsClasses JKQtExtras: Tool Classes 31 | \ingroup JKQtExtras 32 | 33 | \defgroup JKQtExtrasToolsClassesModels Data Models 34 | \ingroup JKQtExtrasToolsClasses 35 | 36 | 37 | */ -------------------------------------------------------------------------------- /readme.txt.in: -------------------------------------------------------------------------------- 1 | ============================================================================= 2 | == JKQtExtras is a library for scientific plotting using Qt5 == 3 | == sub-library: @libBasename@ 4 | ============================================================================= 5 | 6 | Library Information: 7 | version: @PROJECT_VERSION@ 8 | main author/maintainer: Jan Krieger 9 | copyright: (c) 2008-2020 by Jan Krieger 10 | license: GNU LESSER GENERAL PUBLIC LICENSE >= v2.1 11 | repository: https://github.com/jkriege2/JKQtExtras 12 | documentation: http://jkriege2.github.io/JKQtExtras/index.html 13 | 14 | Build information: 15 | used compiler: @CMAKE_CXX_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@ 16 | used Qt version: @Qt5_VERSION@ 17 | built static libs: @BUILD_STATIC_LIBS@ 18 | built shared libs: @BUILD_SHARED_LIBS@ 19 | built examples: @BUILD_EXAMPLES@ 20 | included XITS fonts: @BUILD_INCLUDE_XITS_FONTS@ -------------------------------------------------------------------------------- /ci/install_travis.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Exit on error 4 | set -e 5 | # Echo each command 6 | set -x 7 | 8 | export SOURCE_DIR=`pwd` 9 | export our_install_dir="$HOME/our_usr" 10 | 11 | if [[ ! -d $HOME/conda_root/pkgs ]]; then 12 | rm -rf $HOME/conda_root 13 | if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then 14 | wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh 15 | else 16 | wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh 17 | fi 18 | bash miniconda.sh -b -p $HOME/conda_root 19 | fi 20 | export PATH="$HOME/conda_root/bin:$PATH" 21 | conda config --set always_yes yes --set changeps1 no 22 | conda config --add channels conda-forge --force 23 | # Useful for debugging any issues with conda 24 | conda info -a 25 | 26 | conda_pkgs="qt cmake" 27 | 28 | conda create -q -p $our_install_dir ${conda_pkgs} 29 | 30 | # Since this script is getting sourced, remove error on exit 31 | set +e 32 | set +x 33 | 34 | source activate $our_install_dir 35 | 36 | cd $SOURCE_DIR; 37 | 38 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | # Project Name and Version 4 | project(JKQtExtras LANGUAGES CXX VERSION 2020.01) 5 | 6 | 7 | # set search path for CMake files 8 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) 9 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) 10 | # Find includes in the build directories 11 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 12 | 13 | # Common Includes for JKQtExtras 14 | include(jkqtextras_common_include) 15 | 16 | # Project Name and Version 17 | include(jkqtextras_lib_properties) 18 | 19 | # CMake options with default values and description texts 20 | include(jkqtextras_cmake_options) 21 | 22 | # compiler settings for this lib 23 | include(jkqtextras_common_compilersettings) 24 | 25 | # include Qt with appropriate options to build this lib 26 | include(jkqtextras_common_qtsettings) 27 | 28 | 29 | 30 | # now add subdirectories with the library code ... 31 | add_subdirectory(lib) 32 | # ... and optionally the examples 33 | if(JKQtExtras_BUILD_EXAMPLES) 34 | add_subdirectory(examples) 35 | endif() 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /qmake/staticlib/README.md: -------------------------------------------------------------------------------- 1 | # JKQTPlotter: Build as a STATIC library 2 | 3 | This directory contains Projects that can be used to build a static library of JKQTPlotter (i.e. the contents of the directory [`../lib`](../lib) 4 | 5 | ## QMake 6 | 7 | ### Build shared libraries 8 | There are several `.PRO`-files, that can be used to build the full library, or a limited subsets. They will produce a static link libraries that you can include into your projects, e.g. with the following QMake-snippet: 9 | 10 | ```.qmake 11 | # include JKQTPlotter library 12 | DEPENDPATH += /qmake/staticlib/ /lib 13 | INCLUDEPATH += /lib 14 | CONFIG (debug, debug|release) { 15 | DEPENDPATH += /qmake/staticlib/debug 16 | LIBS += -L/qmake/staticlib/debug -ljkqtplotterlib_debug 17 | } else { 18 | DEPENDPATH += /qmake/staticlib/release 19 | LIBS += -L/qmake/staticlib/release -ljkqtplotterlib 20 | } 21 | ``` 22 | 23 | This snippet assumes that you built the libraries with the provided `.PRO`-files. 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/jkqtextras_version.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008-2020 Jan W. Krieger () 3 | 4 | 5 | 6 | This software is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 8 | the Free Software Foundation, either version 2.1 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License (LGPL) for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License (LGPL) 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef JKQTEXTRAS_VERSION_DEFINES_H 21 | #define JKQTEXTRAS_VERSION_DEFINES_H 22 | 23 | namespace JKQTEXTRAS_VERSION { 24 | const char* PROJECT_LONGNAME = "@PROJECT_LONGNAME@"; 25 | const char* PROJECT_VERSION = "@PROJECT_VERSION@"; 26 | const char* PROJECT_BITNESS = "@PROJECT_BITNESS@"; 27 | } 28 | 29 | #JKQTEXTRAS_VERSION_DEFINES_H 30 | // vim: ft=cpp 31 | -------------------------------------------------------------------------------- /lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | 4 | 5 | message( STATUS ) 6 | message( STATUS "=============================================================================" ) 7 | message( STATUS "== JKQtExtrasLib Build Information ==" ) 8 | message( STATUS "=============================================================================" ) 9 | message( STATUS "Version: ${PROJECT_VERSION}") 10 | if (CMAKE_BUILD_TYPE) 11 | message( STATUS "Build type: ${CMAKE_BUILD_TYPE}") 12 | endif(CMAKE_BUILD_TYPE) 13 | message( STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" ) 14 | message( STATUS "Architecture: ${CMAKE_CXX_LIBRARY_ARCHITECTURE} / ${CMAKE_LIBRARY_ARCHITECTURE}" ) 15 | message( STATUS "System Name: ${CMAKE_SYSTEM_NAME}" ) 16 | message( STATUS "Processor Name: ${CMAKE_SYSTEM_PROCESSOR}" ) 17 | message( STATUS "Using Qt: ${Qt5_VERSION}" ) 18 | message( STATUS " [at ${Qt5_DIR}]" ) 19 | message( STATUS "Installing to: ${CMAKE_INSTALL_PREFIX}" ) 20 | message( STATUS "=============================================================================" ) 21 | message( STATUS ) 22 | 23 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jkqtextras_version.h.in 24 | ${CMAKE_CURRENT_BINARY_DIR}/jkqtextras_version.h) 25 | 26 | 27 | add_subdirectory(jkqtextras) -------------------------------------------------------------------------------- /examples/jkqtextras_test/testmainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestMainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 800 10 | 600 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 0 27 | 0 28 | 800 29 | 21 30 | 31 | 32 | 33 | 34 | &File 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | &Close 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /doc/dox/whatsnew.dox: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page page_whatsnew What's New (Release Notes/Versions) 4 | This page lists release notes for the diferent version of JKQtExtras 5 | 6 | \tableofcontents 7 | 8 | 9 | 10 | 11 | 12 | \section page_whatsnew_TRUNK trunk 13 | 14 | \subsection page_whatsnew_TRUNK_OVERVIEW trunk: Overview 15 | Changes since creation include: 16 | - JKQTEVisibleHandleSplitter 17 | - JKQTEProgressListWidget and JKQTEProgressListDialog 18 | - JKQTEModernProgressWidget and JKQTEModernProgressDialog 19 | - JKQTEColorSlider 20 | - JKQTEColorSampler 21 | - JKQTEStarRatingWidget 22 | - JKQTEVerticalScrollArea 23 | - JKQTEEnhancedComboBox 24 | - JKQTEDoubleEdit 25 | - JKQTERecentFilesMenu 26 | - JKQTEURLOpenToolButton 27 | - JKQTEDirectorySelectToolButton 28 | - JKQTEFileSelectToolButton 29 | - JKQTEFileExecuteToolButton 30 | - JKQTECheckableStringListModel 31 | . 32 | 33 | \subsection page_whatsnew_TRUNK_DOWNLOAD trunk: Download 34 | 35 | This release is available from: 36 | - Source code branch: https://github.com/jkriege2/JKQtExtras 37 | - Source Code download (ZIP): https://github.com/jkriege2/JKQtExtras/archive/master.zip 38 | - Git-Link: https://github.com/jkriege2/JKQtExtras.git 39 | . 40 | 41 | 42 | 43 | 44 | 45 | 46 | */ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.user 2 | build-* 3 | 4 | 5 | # C++ objects and libs 6 | 7 | *.slo 8 | *.lo 9 | *.o 10 | *.a 11 | *.la 12 | *.lai 13 | *.so 14 | *.dll 15 | *.d 16 | *.dylib 17 | 18 | # Qt-es 19 | 20 | /.qmake.cache 21 | /.qmake.stash 22 | *.pro.user 23 | *.pro.user.* 24 | *.qbs.user 25 | *.qbs.user.* 26 | *.moc 27 | moc_*.cpp 28 | qrc_*.cpp 29 | ui_*.h 30 | Makefile* 31 | *-build-* 32 | 33 | # QtCreator 34 | 35 | *.autosave 36 | 37 | #QtCtreator Qml 38 | *.qmlproject.user 39 | *.qmlproject.user.* 40 | *.Debug 41 | *.Release 42 | /compiledate.h 43 | /compiler.h 44 | *.def 45 | .objs 46 | .rccs 47 | .uis 48 | .mocs 49 | .libs 50 | *~#*# 51 | .#* 52 | .DS_Store 53 | qrc_*.cpp 54 | moc_*.cpp 55 | *.save 56 | *.layout 57 | *.depend 58 | *.log 59 | object_script.* 60 | .dep 61 | *.lst 62 | *.hex 63 | *.elf 64 | *.lst 65 | *.lss 66 | *.sym 67 | *.d 68 | Sicherungskopie_*.cdr 69 | *.snm 70 | *.toc 71 | *.tps 72 | *.t3r 73 | *.dcu 74 | *.~* 75 | *.lck 76 | *.synctex 77 | *.tps 78 | *.toc 79 | *.out 80 | *.snm 81 | *.nav 82 | *.aux 83 | *.def 84 | Thumbs.db 85 | *.prf 86 | *.exe 87 | /doc/html 88 | .qmake.stash 89 | moc_predefs.h 90 | /lib/jkqtextras/*.TMP 91 | /doc/doxygen_log.txt 92 | /doc/*.tmp 93 | *.prl 94 | Sicherungskopie_* 95 | /examples/simpletest_rgbimageplot_opencv/opencv 96 | /build 97 | /*.10-pre1 98 | /install 99 | /.vs 100 | /CMakeSettings.json 101 | /out 102 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtecolorsampler.cpp: -------------------------------------------------------------------------------- 1 | #include "jkqtecolorsampler.h" 2 | #include 3 | 4 | JKQTEColorSampler::JKQTEColorSampler(QWidget *parent) : 5 | QWidget(parent), 6 | m_color("black"), 7 | m_samplerMode(RectangleSampler) 8 | { 9 | 10 | } 11 | 12 | QColor JKQTEColorSampler::color() const 13 | { 14 | return m_color; 15 | } 16 | 17 | JKQTEColorSampler::SamplerMode JKQTEColorSampler::samplerMode() const 18 | { 19 | return m_samplerMode; 20 | } 21 | 22 | QSize JKQTEColorSampler::minimumSizeHint() const 23 | { 24 | return QSize(4,4); 25 | } 26 | 27 | QSize JKQTEColorSampler::sizeHint() const 28 | { 29 | return QSize(16,16); 30 | } 31 | 32 | void JKQTEColorSampler::setColor(QColor col) 33 | { 34 | m_color=col; 35 | update(); 36 | } 37 | 38 | void JKQTEColorSampler::setSamplerMode(JKQTEColorSampler::SamplerMode m) 39 | { 40 | m_samplerMode=m; 41 | update(); 42 | } 43 | 44 | void JKQTEColorSampler::paintEvent(QPaintEvent */*ev*/) 45 | { 46 | QPainter p(this); 47 | p.setRenderHints(QPainter::Antialiasing); 48 | QPainterPath path; 49 | if (m_samplerMode==RectangleSampler) { 50 | path.addRect(QRect(0,0,width()-1,height()-1)); 51 | } else if (m_samplerMode==CircleSampler) { 52 | int d=qMin(width(),height()); 53 | path.addEllipse((width()-d)/2,(height()-d)/2,d-1,d-1); 54 | } 55 | p.fillPath(path, QBrush(m_color)); 56 | p.setPen(palette().windowText().color()); 57 | p.drawPath(path); 58 | } 59 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqteverticalscrollarea.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include "jkqteverticalscrollarea.h" 20 | 21 | #include 22 | 23 | JKQTEVerticalScrollArea::JKQTEVerticalScrollArea(QWidget* parent): 24 | QScrollArea(parent) 25 | { 26 | //ctor 27 | } 28 | 29 | JKQTEVerticalScrollArea::~JKQTEVerticalScrollArea() 30 | { 31 | //dtor 32 | } 33 | 34 | void JKQTEVerticalScrollArea::resizeEvent(QResizeEvent * event) { 35 | QWidget* w=widget(); 36 | if (w) { 37 | int minw=w->minimumWidth(); 38 | int neww=event->size().width()-2; 39 | int wid=qMax(minw, neww); 40 | w->resize(wid, w->height()); 41 | } 42 | 43 | QScrollArea::resizeEvent(event); 44 | } 45 | -------------------------------------------------------------------------------- /cmake/jkqtextras_deployqt.cmake: -------------------------------------------------------------------------------- 1 | function(jkqtextras_deployqt TARGET_NAME) 2 | #use windeploy 3 | if (WIN32) 4 | get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION) 5 | get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) 6 | find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}") 7 | find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}") 8 | 9 | set(WINDEPLOYQTOPTION "--release") 10 | if (CMAKE_BUILD_TYPE STREQUAL "Debug") 11 | set(WINDEPLOYQTOPTION "--debug") 12 | endif() 13 | 14 | # install system runtime lib 15 | include( InstallRequiredSystemLibraries ) 16 | if( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ) 17 | install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT System ) 18 | endif( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ) 19 | 20 | get_filename_component(CMAKE_CXX_COMPILER_BINPATH ${CMAKE_CXX_COMPILER} DIRECTORY ) 21 | add_custom_command(TARGET ${TARGET_NAME} POST_BUILD 22 | COMMAND "${CMAKE_COMMAND}" -E 23 | env PATH="${CMAKE_CXX_COMPILER_BINPATH}\;${_qt_bin_dir}" "${WINDEPLOYQT_EXECUTABLE}" 24 | --compiler-runtime 25 | -xml 26 | -printsupport 27 | ${WINDEPLOYQTOPTION} 28 | \"$\" 29 | COMMENT "Running windeployqt ... " 30 | ) 31 | endif(WIN32) 32 | endfunction(jkqtextras_deployqt) 33 | -------------------------------------------------------------------------------- /cmake/jkqtextras_cmake_options.cmake: -------------------------------------------------------------------------------- 1 | if(NOT DEFINED JKQtExtras_BUILD_SHARED_LIBS) 2 | option(JKQtExtras_BUILD_SHARED_LIBS "Build as shared library" ON) 3 | endif() 4 | if(NOT DEFINED JKQtExtras_BUILD_STATIC_LIBS) 5 | option(JKQtExtras_BUILD_STATIC_LIBS "Build as static library" OFF) 6 | endif() 7 | if(NOT DEFINED JKQtExtras_BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE) 8 | option(JKQtExtras_BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE "If set, the build-type (debug/release/...) is appended to the library name" ON) 9 | endif() 10 | if(NOT DEFINED JKQtExtras_BUILD_EXAMPLES) 11 | option(JKQtExtras_BUILD_EXAMPLES "Build the examples examples" ON) 12 | endif() 13 | if(NOT DEFINED CMAKE_INSTALL_PREFIX) 14 | option(CMAKE_INSTALL_PREFIX "Install directory" ${CMAKE_CURRENT_SOURCE_DIR}/install) 15 | endif() 16 | 17 | 18 | #evaluate the settings above 19 | if (NOT CMAKE_INSTALL_LIBDIR) 20 | set(CMAKE_INSTALL_LIBDIR "lib") 21 | endif() 22 | 23 | if (NOT CMAKE_INSTALL_BINDIR) 24 | set(CMAKE_INSTALL_BINDIR "bin") 25 | endif() 26 | 27 | if (NOT CMAKE_INSTALL_INCLUDEDIR) 28 | set(CMAKE_INSTALL_INCLUDEDIR "include") 29 | endif() 30 | 31 | # place all DLLs and EXEs in the subdirectory output of the top level directory of the build tree 32 | set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output) 33 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output) 34 | 35 | 36 | if(JKQtExtras_BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE) 37 | set(JKQtExtras_LIBNAME_ADDITION "_$") #"_${CMAKE_BUILD_TYPE}") 38 | else() 39 | set(JKQtExtras_LIBNAME_ADDITION ) 40 | endif() 41 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqteverticalscrollarea.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #ifndef JKQTEVERTICALSCROLLAREA_H 20 | #define JKQTEVERTICALSCROLLAREA_H 21 | 22 | #include "jkqtextras_imexport.h" 23 | #include 24 | 25 | /*! \brief a scrollarea which shows only vertical scrollbars whenever possible (minimum widget size) and otherwise tries 26 | to maximize the size of the widget. 27 | \ingroup JKQtExtrasWidgetsLayout 28 | 29 | 30 | */ 31 | class JKQTEXTRAS_LIB_EXPORT JKQTEVerticalScrollArea : public QScrollArea { 32 | Q_OBJECT 33 | public: 34 | JKQTEVerticalScrollArea(QWidget* parent); 35 | virtual ~JKQTEVerticalScrollArea(); 36 | protected: 37 | virtual void resizeEvent(QResizeEvent* event); 38 | private: 39 | }; 40 | 41 | #endif // JKQTEVERTICALSCROLLAREA_H 42 | -------------------------------------------------------------------------------- /doc/dox/mainpage.dox: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \mainpage JKQtExtras - A Collection of Diverse Qt4/5 Widgets 4 | 5 | - This is an extensive library of different widgets and tools for Qt (>= 4.7, tested with Qt up to 5.11). 6 | - This software is licensed under the term of the GNU Lesser General Public License 2.1 7 | (LGPL 2.1) or above. See \ref licensesec for details. 8 | - Online-Documentation (http://jkriege2.github.io/JKQtExtras/index.html) 9 | - Source Code Repository (https://github.com/jkriege2/JKQtExtras) 10 | - Tagged Releases (https://github.com/jkriege2/JKQtExtras/releases) 11 | 12 | 13 | \section jkqtp_main_features Main Features 14 | - \ref WidgetGallery 15 | - CMake-based build system, see: \ref page_buildinstructions_CMAKE 16 | - \ref exampleTutorialProjects "extensive set of Examples and Tutorials" 17 | - extensive doxygen-generated Online-Documentation (http://jkriege2.github.io/JKQtExtras/index.html) 18 | - source code hosted&developed on GitHub https://github.com/jkriege2/JKQtExtras (including continuous integration builds: https://ci.appveyor.com/project/jkriege2/JKQtExtras/branch/master) 19 | 20 | \section JKQtExtrastic Table Of Contents 21 | - Documentation of Major Classes: 22 | - \ref JKQtExtras 23 | - \ref WidgetGallery 24 | - \ref licensepage 25 | - \ref page_buildinstructions 26 | - \ref page_whatsnew 27 | - \ref exampleTutorialProjects 28 | 29 | 30 | */ -------------------------------------------------------------------------------- /lib/jkqtextras/jkqteenhancedcombobox.cpp: -------------------------------------------------------------------------------- 1 | #include "jkqteenhancedcombobox.h" 2 | #include 3 | #include 4 | #include 5 | 6 | JKQTEEnhancedComboBox::JKQTEEnhancedComboBox(QWidget *parent) : 7 | QComboBox(parent) 8 | { 9 | m_readonly=false; 10 | m_oldEditable=isEditable(); 11 | } 12 | 13 | void JKQTEEnhancedComboBox::setReadonly(bool readonly) { 14 | m_readonly=readonly; 15 | if (lineEdit()) lineEdit()->setReadOnly(readonly); 16 | if (isEditable() && readonly) { 17 | m_oldEditable=true; 18 | setEditable(false); 19 | } 20 | if (!readonly && (m_oldEditable!=isEditable())) { 21 | setEditable(m_oldEditable); 22 | } 23 | } 24 | 25 | bool JKQTEEnhancedComboBox::readonly() const 26 | { 27 | return m_readonly; 28 | } 29 | 30 | void JKQTEEnhancedComboBox::showPopup() { 31 | if (!m_readonly) { 32 | QComboBox::showPopup(); 33 | 34 | 35 | 36 | QFontMetrics fm(view()->font()); 37 | int width=view()->size().width(); 38 | for (int i=0; iwidth) width=w; 41 | } 42 | 43 | view()->setMinimumWidth(qMax(width, this->width())); 44 | view()->setGeometry(0,0,width, view()->size().height()); 45 | 46 | } 47 | } 48 | 49 | void JKQTEEnhancedComboBox::keyPressEvent ( QKeyEvent * e ) { 50 | if (e->key()==Qt::Key_Enter || e->key()==Qt::Key_Return) emit editingFinished(); 51 | // else e->ignore(); 52 | if (!m_readonly) QComboBox::keyPressEvent(e); 53 | } 54 | 55 | void JKQTEEnhancedComboBox::keyReleaseEvent ( QKeyEvent * e ) { 56 | if (!m_readonly) QComboBox::keyReleaseEvent(e); 57 | } 58 | 59 | void JKQTEEnhancedComboBox::wheelEvent ( QWheelEvent * e ) { 60 | if (!m_readonly) QComboBox::wheelEvent(e); 61 | } 62 | -------------------------------------------------------------------------------- /qmake/sharedlib/README.md: -------------------------------------------------------------------------------- 1 | # JKQtExtras: Build as a SHARED library 2 | 3 | This directory contains Projects that can be used to build a shared library of JKQtExtras (i.e. the contents of the directory [`../lib`](../lib) 4 | 5 | ## QMake 6 | 7 | ### Build shared libraries 8 | There are several `.PRO`-files, that can be used to build the full library, or a limited subsets. They will produce a dynamic link library that you can include into your projects, e.g. with the following QMake-snippet: 9 | 10 | ```.qmake 11 | # include JKQtExtras library 12 | DEPENDPATH += /lib /qmake/sharedlib/JKQtExtraslib 13 | INCLUDEPATH += /lib 14 | CONFIG (debug, debug|release) { 15 | # ensure that DLLs are copied to the output directory 16 | install_JKQtExtras_dll.files = /qmake/sharedlib/JKQtExtraslib/debug/JKQtExtraslib_debug.* 17 | install_JKQtExtras_dll.path = $$OUT_PWD 18 | INSTALLS += install_JKQtExtras_dll 19 | # link agains DLLs 20 | DEPENDPATH += /qmake/sharedlib/JKQtExtraslib/debug 21 | LIBS += -L/qmake/sharedlib/JKQtExtraslib/debug -lJKQtExtraslib_debug 22 | } else { 23 | # ensure that DLLs are copied to the output directory 24 | install_JKQtExtras_dll.files = /qmake/sharedlib/JKQtExtraslib/release/JKQtExtraslib.* 25 | install_JKQtExtras_dll.path = $$OUT_PWD 26 | INSTALLS += install_JKQtExtras_dll 27 | DEPENDPATH += /qmake/sharedlib/JKQtExtraslib/release 28 | # link agains DLLs 29 | LIBS += -L/qmake/sharedlib/JKQtExtraslib/release -lJKQtExtraslib 30 | } 31 | ``` 32 | 33 | This snippet assumes that you built the libraries with the provided `.PRO`-files. 34 | 35 | *Note* that you will have to run a deployment step `make install` before running your executable, so the shared libararies are actually copied to the output directory (see `INSTALLS + ...` above). 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtecolorsampler.h: -------------------------------------------------------------------------------- 1 | #ifndef JKQTECOLORSAMPLER_H 2 | #define JKQTECOLORSAMPLER_H 3 | 4 | #include 5 | #include "jkqtextras_imexport.h" 6 | 7 | /*! \brief a widget which display a color (sample) 8 | \ingroup JKQtExtrasWidgetsLabels 9 | 10 | Screenshots: 11 | \image html JKQTEColorSampler.png 12 | 13 | Basic usage is simple: 14 | 15 | \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTEColorSampler 16 | 17 | */ 18 | class JKQTEXTRAS_LIB_EXPORT JKQTEColorSampler : public QWidget 19 | { 20 | Q_OBJECT 21 | Q_PROPERTY(SamplerMode samplerMode READ samplerMode WRITE setSamplerMode USER true) 22 | Q_PROPERTY(QColor color READ color WRITE setColor USER true) 23 | public: 24 | /** \brief available modes for the slider 25 | * 26 | * the appearance and the range of the slider depend on this */ 27 | enum SamplerMode { 28 | CircleSampler=0, /**< color is shown as a filled circle \image html JKQTEColorSampler_CircleSampler.png */ 29 | RectangleSampler, /**< color is shown as a filled rectangle \image html JKQTEColorSampler_RectangleSampler.png */ 30 | }; 31 | Q_ENUM(SamplerMode) 32 | 33 | explicit JKQTEColorSampler(QWidget *parent = nullptr); 34 | 35 | /** \brief sets the color to display */ 36 | QColor color() const; 37 | /** \brief sets the display mode of the color sampler */ 38 | SamplerMode samplerMode() const; 39 | 40 | virtual QSize minimumSizeHint() const override; 41 | virtual QSize sizeHint() const override; 42 | public slots: 43 | /** \brief sets the color to display */ 44 | void setColor(QColor col); 45 | /** \brief sets the display mode of the color sampler */ 46 | void setSamplerMode(SamplerMode m); 47 | signals: 48 | 49 | protected: 50 | QColor m_color; 51 | SamplerMode m_samplerMode; 52 | 53 | /** \brief paints the sampler */ 54 | virtual void paintEvent(QPaintEvent *ev) override; 55 | }; 56 | 57 | #endif // JKQTECOLORSAMPLER_H 58 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqteenhancedcombobox.h: -------------------------------------------------------------------------------- 1 | #ifndef JKQTEENHANCEDCOMBOBOX_H 2 | #define JKQTEENHANCEDCOMBOBOX_H 3 | 4 | #include 5 | #include "jkqtextras_imexport.h" 6 | #include 7 | 8 | /** \brief this QComboox descendent with en hanced features (e.g. can be set to 9 | * read-only, editingFinished() signal, ...) 10 | * \ingroup JKQtExtrasWidgetsEdits 11 | * 12 | * Added features are: 13 | * - setReadonly() slot, which shows the combobox in the standardway, but prevents editing (and deletes any key-press events) 14 | * - editingFinished() signal, which is emitted when "return" or "enter" key is pressed 15 | * . 16 | * 17 | * \image html JKQTEEnhancedComboBox.png 18 | * 19 | * Usage example: 20 | * \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTEEnhancedComboBox 21 | */ 22 | class JKQTEXTRAS_LIB_EXPORT JKQTEEnhancedComboBox : public QComboBox { 23 | Q_OBJECT 24 | Q_PROPERTY(bool readonly READ readonly WRITE setReadonly USER true) 25 | public: 26 | explicit JKQTEEnhancedComboBox(QWidget *parent = 0); 27 | 28 | virtual void showPopup(); 29 | /** \brief is the combobox in read-only mode? */ 30 | bool readonly() const; 31 | 32 | 33 | public slots: 34 | /** \brief switches the combobox between read-only mode and editable mode */ 35 | void setReadonly(bool readonly); 36 | 37 | signals: 38 | /** \brief signal, which is emitted when the editing of the widget finishes. 39 | * 40 | * This signal is emitted when \c setEditbale(true) was set and the editing in the widget 41 | * finished, i.e. a text is entered and RETURN or ENTER is pressed. 42 | */ 43 | void editingFinished(); 44 | 45 | protected: 46 | bool m_readonly; 47 | bool m_oldEditable; 48 | virtual void keyPressEvent ( QKeyEvent * e ); 49 | virtual void keyReleaseEvent ( QKeyEvent * e ); 50 | virtual void wheelEvent ( QWheelEvent * e ); 51 | }; 52 | 53 | #endif // JKQTEENHANCEDCOMBOBOX_H 54 | 55 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | sudo: false 3 | compiler: 4 | - gcc 5 | - clang 6 | os: 7 | - linux 8 | - osx 9 | dist: focal 10 | osx_image: xcode12.2 11 | 12 | matrix: 13 | exclude: 14 | # Disable all automatic entries in the test matrix 15 | - compiler: clang 16 | - compiler: gcc 17 | - os: osx 18 | - os: linux 19 | include: 20 | # Explicitly add tests that we want to run 21 | - env: BUILD_DOXYGEN="yes" 22 | compiler: gcc 23 | os: linux 24 | addons: 25 | apt: 26 | packages: 27 | - doxygen 28 | - doxygen-doc 29 | - doxygen-latex 30 | - doxygen-gui 31 | - graphviz 32 | - clang-9 33 | - libclang-9-dev 34 | - libclang-cpp9 35 | install: 36 | - pwd 37 | - doxygen --version 38 | ############################################################################ 39 | # All the dependencies are installed in ${TRAVIS_BUILD_DIR}/deps/ 40 | ############################################################################ 41 | - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" 42 | - mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR} 43 | ############################################################################ 44 | # Install a recent Doxygen 45 | ############################################################################ 46 | - DOXYGEN_URL="http://doxygen.nl/files/doxygen-1.8.20.linux.bin.tar.gz" 47 | - mkdir doxygen 48 | - travis_retry wget -O - ${DOXYGEN_URL} | tar --strip-components=1 -xz -C doxygen 49 | - export PATH=${DEPS_DIR}/doxygen/bin:${PATH} 50 | - doxygen --version 51 | script: 52 | - pwd 53 | - cd ${TRAVIS_BUILD_DIR} 54 | - cd doc 55 | - doxygen --version 56 | - doxygen Doxyfile 57 | - echo "" > html/.nojekyll 58 | - compiler: clang 59 | os: osx 60 | - compiler: clang 61 | os: linux 62 | addons: 63 | apt: 64 | packages: 65 | - libglu1-mesa-dev 66 | - compiler: gcc 67 | os: linux 68 | addons: 69 | apt: 70 | packages: 71 | - libglu1-mesa-dev 72 | 73 | install: 74 | - source ci/install_travis.sh 75 | 76 | script: 77 | - mkdir build 78 | - cd build 79 | - cmake -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX .. 80 | - cmake --build . --target install 81 | 82 | notifications: 83 | email: false 84 | 85 | deploy: 86 | provider: pages 87 | verbose: true 88 | deployment_file: true 89 | skip_cleanup: true 90 | local_dir: doc/html 91 | github_token: $GH_REPO_TOKEN 92 | on: 93 | branch: master 94 | condition: $BUILD_DOXYGEN = yes 95 | -------------------------------------------------------------------------------- /doc/dox/gallery.dox: -------------------------------------------------------------------------------- 1 | /*! 2 | \page WidgetGallery JKQTExtras Gallery 3 | 4 | 5 |
\ref JKQtExtrasWidgetsLayout 6 |
\image html JKQTEVisibleHandleSplitter_logo.png 7 | JKQTEVisibleHandleSplitter 8 | \copybrief JKQTEVisibleHandleSplitter 9 |
10 | JKQTEVerticalScrollArea 11 | \copybrief JKQTEVerticalScrollArea 12 | 13 |
\ref JKQtExtrasWidgetsProgress 14 |
\image html JKQTEProgressListWidget_logo.png 15 | JKQTEProgressListWidget 16 | \copybrief JKQTEProgressListWidget 17 | 18 |
\image html JKQTEProgressListDialog_logo.png 19 | JKQTEProgressListDialog 20 | \copybrief JKQTEProgressListDialog 21 | 22 |
\image html JKQTEModernProgressWidget_logo.png 23 | JKQTEModernProgressWidget 24 | \copybrief JKQTEModernProgressWidget 25 | 26 |
\image html JKQTEModernProgressDialog_logo.png 27 | JKQTEModernProgressDialog 28 | \copybrief JKQTEModernProgressDialog 29 | 30 |
\ref JKQtExtrasWidgetsSliders 31 |
\image html JKQTEColorSlider_logo.png 32 | JKQTEColorSlider 33 | \copybrief JKQTEColorSlider 34 | 35 |
\ref JKQtExtrasWidgetsLabels 36 |
\image html JKQTEColorSampler_logo.png 37 | JKQTEColorSampler 38 | \copybrief JKQTEColorSampler 39 |
\image html JKQTEStarRatingWidget_logo.png 40 | JKQTEStarRatingWidget 41 | \copybrief JKQTEStarRatingWidget 42 | 43 | 44 |
\ref JKQtExtrasWidgetsEdits 45 |
\image html JKQTEEnhancedComboBox_logo.png 46 | JKQTEEnhancedComboBox 47 | \copybrief JKQTEEnhancedComboBox 48 |
\image html JKQTEDoubleEdit_logo.png 49 | JKQTEDoubleEdit 50 | \copybrief JKQTEDoubleEdit 51 | 52 |
\ref JKQtExtrasWidgetsButtons 53 |
\image html JKQTEURLOpenToolButton_logo.png 54 | JKQTEURLOpenToolButton 55 | \copybrief JKQTEURLOpenToolButton 56 |
\image html JKQTEDirectorySelectToolButton_logo.png 57 | JKQTEDirectorySelectToolButton 58 | \copybrief JKQTEDirectorySelectToolButton 59 |
\image html JKQTEFileSelectToolButton_logo.png 60 | JKQTEFileSelectToolButton 61 | \copybrief JKQTEFileSelectToolButton 62 |
\image html JKQTEFileExecuteToolButton_logo.png 63 | JKQTEFileExecuteToolButton 64 | \copybrief JKQTEFileExecuteToolButton 65 | 66 | 67 |
\ref JKQtExtrasWidgetsMenus 68 |
\image html JKQTERecentFilesMenu_logo.png 69 | JKQTERecentFilesMenu 70 | \copybrief JKQTERecentFilesMenu 71 | 72 | 73 |
\ref JKQtExtrasToolsClassesModels 74 |
\image html JKQTECheckableStringListModel_logo.png 75 | JKQTECheckableStringListModel 76 | \copybrief JKQTECheckableStringListModel 77 | 78 |
79 | 80 | */ -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtecheckablestringlistmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JKQTECHECKABLESTRINGLISTMODEL_H 19 | #define JKQTECHECKABLESTRINGLISTMODEL_H 20 | 21 | #include 22 | #include 23 | #include "jkqtextras_imexport.h" 24 | 25 | /** \brief a QStringListModel, which allows to check/uncheck each entry 26 | * \ingroup JKQtExtrasToolsClassesModels 27 | * 28 | * Usage in QListView: 29 | * \image html JKQTECheckableStringListModel.png 30 | * 31 | * Basic usage is simple: 32 | * 33 | * \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTECheckableStringListModel 34 | * 35 | */ 36 | class JKQTEXTRAS_LIB_EXPORT JKQTECheckableStringListModel : public QStringListModel { 37 | Q_OBJECT 38 | public: 39 | explicit JKQTECheckableStringListModel(QObject *parent = 0); 40 | explicit JKQTECheckableStringListModel(bool editable, bool checkable, QObject *parent = 0); 41 | 42 | /** \brief check the \a i -th entry */ 43 | void setChecked(int i); 44 | /** \brief check/uncheck the \a i -th entry */ 45 | void setChecked(int i, bool c); 46 | /** \brief uncheck the \a i -th entry */ 47 | void setUnChecked(int i); 48 | /** \brief is the \a i -th entry checked? */ 49 | bool isChecked(int i) const; 50 | /** \brief uncheck all items */ 51 | void unCheckAll(); 52 | /** \brief check all items */ 53 | void checkAll(); 54 | 55 | /** \brief model contents (texts!) is editable */ 56 | void setTextEditable(bool editable); 57 | /** \brief is the model contents (texts!) editable? */ 58 | bool isTextEditable() const; 59 | 60 | /** \brief model contents (texts!) is editable */ 61 | void setCheckable(bool checkable); 62 | /** \brief is the model contents (texts!) editable? */ 63 | bool isCheckable() const; 64 | 65 | QVariant data(const QModelIndex &index, int role) const; 66 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); 67 | 68 | Qt::ItemFlags flags(const QModelIndex &index) const; 69 | 70 | 71 | protected: 72 | QSet m_check; 73 | bool m_editable; 74 | bool m_checkable; 75 | }; 76 | 77 | #endif // JKQTECHECKABLESTRINGLISTMODEL_H 78 | -------------------------------------------------------------------------------- /doc/jkqtplotter_stylesheet.css: -------------------------------------------------------------------------------- 1 | /* Customized Stylesheet for JKQTPlotter */ 2 | 3 | dl.section { 4 | margin-left: 7px; 5 | } 6 | 7 | dl.note { 8 | padding-left: 39px; 9 | border-color: black; 10 | border-width: 2px; 11 | border-style: solid; 12 | border-left-width: 4px; 13 | border-left-color: #D0C000; 14 | background-image: linear-gradient(135deg, #fdfcfb 0%, #e2d1c3 100%); 15 | border-radius: 8px; 16 | background-image: url(icon_note.png); 17 | background-position: 3px 3px; 18 | background-repeat: no-repeat; 19 | min-height: 32px; 20 | } 21 | 22 | dl.see { 23 | padding-left: 39px; 24 | border-color: black; 25 | border-width: 2px; 26 | border-style: solid; 27 | border-left-width: 4px; 28 | border-left-color: #55AAD1; 29 | background-image: linear-gradient(135deg, #fff1eb 0%, #ace0f9 100%); 30 | border-radius: 8px; 31 | background-image: url(icon_see.png); 32 | background-position: 3px 3px; 33 | background-repeat: no-repeat; 34 | min-height: 32px; 35 | } 36 | 37 | div.fragment { 38 | padding: 4px; 39 | padding-left: 39px; 40 | border-color: black; 41 | border-width: 1px; 42 | border-style: solid; 43 | border-left-width: 8px; 44 | border-left-color: #666699; 45 | background-image: linear-gradient(to top, #e6e9f0 0%, #eef1f5 100%); 46 | background-image: url(icon_code.png); 47 | background-position: 3px 3px; 48 | background-repeat: no-repeat; 49 | min-height: 32px; 50 | min-width: 50%; 51 | display: inline-block; 52 | } 53 | 54 | 55 | h2.memtitle { 56 | padding: 8px; 57 | border-top: 1px solid #A8B8D9; 58 | border-left: 1px solid #A8B8D9; 59 | border-right: 1px solid #A8B8D9; 60 | border-bottom: 0px; 61 | border-top-right-radius: 4px; 62 | border-top-left-radius: 4px; 63 | margin-bottom: -1px; 64 | background-image: url('nav_f.png'); 65 | background-repeat: repeat-x; 66 | background-color: #E2E8F2; 67 | line-height: 1.25; 68 | font-weight: 300; 69 | float: left; 70 | margin: 0px; 71 | margin-right: 15px; 72 | width: auto; 73 | } 74 | 75 | h1, h2, h3, h4, h5, h6 { 76 | margin-left: -5pt; 77 | margin-bottom: 16px; 78 | margin-right: 15px; 79 | padding: 4px; 80 | background: #eeeeee; 81 | width: 95%; 82 | } 83 | 84 | h1 { 85 | border-bottom: 2px solid black; 86 | border-left: 2px solid black; 87 | font-size: 22pt; 88 | margin-top: 64pt; 89 | } 90 | 91 | h2 { 92 | border-bottom: 1.5px solid black; 93 | border-left: 1.5px solid black; 94 | font-size: 16pt; 95 | font-weight: 150%; 96 | } 97 | 98 | h3 { 99 | border-bottom: 1px solid black; 100 | border-left: 1px solid black; 101 | font-size: 14pt; 102 | font-weight: 100%; 103 | } 104 | 105 | h2.groupheader { 106 | border-left: 0px; 107 | border-top: 0px; 108 | border-bottom-width: 8pt; 109 | background: #dbdbea; 110 | font-size: 28pt; 111 | } 112 | 113 | div.title { 114 | font-size: 28pt; 115 | } 116 | 117 | div.image { 118 | padding: 4px; 119 | text-align: left; 120 | margin-left: 32pt; 121 | } 122 | 123 | div.caption { 124 | margin-left: 64pt; 125 | text-align: left; 126 | } 127 | 128 | table.params , table.tparams { 129 | border: 1px solid black; 130 | border-left-width: 8px; 131 | border-left-color: #66001a; 132 | width: 90%; 133 | padding: 0px; 134 | } 135 | 136 | td.paramname { 137 | margin: 0px; 138 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at jan@jkrieger.de. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JKQtExtras - A Library of Useful Qt Widgets and Tools 2 | 3 | This software is licensed under the term of the [GNU Lesser General Public License 2.1 4 | (LGPL 2.1)](./LICENSE) or above. 5 | 6 | [![License](https://img.shields.io/github/license/jkriege2/JKQtExtras)](https://github.com/jkriege2/JKQtExtras/blob/master/LICENSE) 7 | ![Language](https://img.shields.io/github/languages/top/jkriege2/JKQtExtras) 8 | [![Qt 4&5](https://img.shields.io/badge/Qt-4%20%26%205-brightgreen)](https://doc.qt.io/qt-5/) 9 | [![Documentation](https://img.shields.io/badge/documentation-online-blue)](http://jkriege2.github.io/JKQtExtras/index.html) 10 | 11 | [![CI: Windows Build](https://img.shields.io/appveyor/ci/jkriege2/JKQtExtras/master?label=CI%20Windows%20Build)](https://ci.appveyor.com/project/jkriege2/jkqtextras/branch/master) 12 | [![CI: Documentation/Linux/MacOX Build](https://img.shields.io/travis/jkriege2/JKQtExtras/master?label=CI%3A%20Documentation%2FLinux%2FMacOX%20Build)](https://travis-ci.org/jkriege2/JKQtExtras) 13 | 14 | [![Commit Activity](https://img.shields.io/github/commit-activity/m/jkriege2/JKQtExtras)](https://github.com/jkriege2/JKQtExtras/pulse) 15 | [![Last Commit](https://img.shields.io/github/last-commit/jkriege2/JKQtExtras)](https://github.com/jkriege2/JKQtExtras/pulse) 16 | [![Contributors](https://img.shields.io/github/contributors/jkriege2/JKQtExtras)](https://github.com/jkriege2/JKQtExtras/graphs/contributors) 17 | 18 | [![Open Issues](https://img.shields.io/github/issues/jkriege2/JKQtExtras)](https://github.com/jkriege2/JKQtExtras/issues) 19 | [![Closed Issues](https://img.shields.io/github/issues-closed/jkriege2/JKQtExtras)](https://github.com/jkriege2/JKQtExtras/issues?q=is%3Aissue+is%3Aclosed) 20 | 21 | [![Open PRs](https://img.shields.io/github/issues-pr/jkriege2/JKQtExtras)](https://github.com/jkriege2/JKQtExtras/pulls) 22 | [![Closed PRs](https://img.shields.io/github/issues-pr-closed/jkriege2/JKQtExtras)](https://github.com/jkriege2/JKQtExtras/pulls?q=is%3Apr+is%3Aclosed) 23 | 24 | [![Code Quality](https://www.code-inspector.com/project/12237/score/svg) ![Code Grade](https://www.code-inspector.com/project/12237/status/svg)](https://frontend.code-inspector.com/public/project/12237/JKQtExtras/dashboard) 25 | 26 | ## Main Features 27 | - [Widget Gallery](https://jkriege2.github.io/JKQtExtras/_widget_gallery.html) 28 | - CMake-based build system 29 | - extensive set of [Examples/Tutorials](./examples/README.md) 30 | - extensive doxygen-generated [Documentation](http://jkriege2.github.io/JKQtExtras/index.html) 31 | 32 | ## [Documentation](http://jkriege2.github.io/JKQtExtras/index.html) 33 | A Documentation (auto-)generated with [doxygen](http://www.doxygen.nl/) from the trunk source code can be found here: 34 | **[http://jkriege2.github.io/JKQtExtras/index.html](http://jkriege2.github.io/JKQtExtras/index.html)** 35 | 36 | Documentation is auto-generated after pushes by [Travis](https://travis-ci.org/jkriege2/JKQtExtras): [![Build Status](https://travis-ci.org/jkriege2/JKQtExtras.svg?branch=master)](https://travis-ci.org/jkriege2/JKQtExtras) 37 | 38 | ## [Examples](./examples/) 39 | [Examples and tutorials](./examples/) are available in the folder [`./examples/`](./examples). 40 | 41 | 42 | ## Building 43 | 44 | JKQtExtras contains two different build systems: A modern [CMake](https://cmake.org/)-based build and an older (and deprecated!) QMake-based build (which works out of the box with Qt 5.x). Both systems are explained in detail in http://jkriege2.github.io/JKQtExtras/page_buildinstructions.html. 45 | 46 | 47 | With [CMake](https://cmake.org/) you can easily build JKQtExtras and all its examples, by calling something like: 48 | ``` 49 | $ mkdir build; cd build 50 | $ cmake .. -G "" "-DCMAKE_PREFIX_PATH=" 51 | $ cmake --build . --config "Debug" 52 | ``` 53 | 54 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 0.{build}-{branch} 2 | 3 | image: 4 | - Visual Studio 2017 5 | 6 | environment: 7 | global: 8 | QTVER: 5.11 9 | JOMDIR: C:\Qt\Tools\QtCreator\bin 10 | MINGWDIR: C:\Qt\Tools\mingw530_32 11 | VSVER: 0 12 | 13 | matrix: 14 | - QTABI: mingw53_32 15 | ARCH: x86 16 | MAKETOOL: mingw32-make 17 | CMAKE_GENERATOR: "MinGW Makefiles" 18 | USE_CMAKE: true 19 | MSBUILD_FLAGS: 20 | # - QTABI: mingw53_32 21 | # ARCH: x86 22 | # QMAKESPEC: win32-g++ 23 | # MAKETOOL: mingw32-make 24 | # USE_CMAKE: false 25 | - QTABI: msvc2017_64 26 | ARCH: x64 27 | VSVER: 2017 28 | CMAKE_GENERATOR: "Visual Studio 15 2017 Win64" 29 | USE_CMAKE: true 30 | MSBUILD_FLAGS: /verbosity:minimal /maxcpucount 31 | # - QTABI: msvc2017_64 32 | # ARCH: x64 33 | # VSVER: 2017 34 | # QMAKESPEC: win32-msvc 35 | # MAKETOOL: jom 36 | # USE_CMAKE: false 37 | - QTABI: msvc2015 38 | ARCH: x86 39 | VSVER: 14 40 | CMAKE_GENERATOR: "Visual Studio 15 2017" 41 | USE_CMAKE: true 42 | MSBUILD_FLAGS: /verbosity:minimal /maxcpucount 43 | # - QTABI: msvc2015 44 | # ARCH: x86 45 | # VSVER: 14 46 | # QMAKESPEC: win32-msvc 47 | # MAKETOOL: jom 48 | # USE_CMAKE: false 49 | 50 | skip_tags: true 51 | 52 | build: 53 | parallel: true 54 | verbosity: detailed 55 | 56 | configuration: 57 | - release 58 | # - debug 59 | 60 | 61 | install: 62 | - IF %VSVER% GTR 14 ( 63 | call "C:\Program Files (x86)\Microsoft Visual Studio\%VSVER%\Community\VC\Auxiliary\Build\vcvarsall.bat" %ARCH% 64 | ) ELSE ( 65 | IF %VSVER% GTR 0 ( 66 | call "C:\Program Files (x86)\Microsoft Visual Studio "%VSVER%".0\VC\vcvarsall.bat" %ARCH% 67 | ) ELSE ( 68 | set "PATH=%MINGWDIR%\bin;%PATH%" 69 | ) 70 | ) 71 | - set PATH=C:\Qt\%QTVER%\%QTABI%\bin;%JOMDIR%;%PATH% 72 | - echo "BUILD ID Qt%QTVER%_%QTABI%_%APPVEYOR_BUILD_VERSION%_%CONFIGURATION%" 73 | # Rename sh.exe as sh.exe in PATH interferes with MinGW 74 | - rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe" 75 | 76 | build_script: 77 | # - dir "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" 78 | # - type "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\random" 79 | # - dir "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" 80 | # - type "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\random" 81 | - mkdir build 82 | - cd build 83 | - if "%CONFIGURATION%"=="release" (set CMAKE_CONFIGURATION=Release) else (set CMAKE_CONFIGURATION=Debug) 84 | - if [%USE_CMAKE%]==[true] ( 85 | echo "Call CMake..." 86 | cmake --version && 87 | cmake -G "%CMAKE_GENERATOR%" "-DCMAKE_PREFIX_PATH=%QT5%" .. && 88 | echo "Build..." && 89 | cmake --build . --config "%CMAKE_CONFIGURATION%" -- %MSBUILD_FLAGS% ) 90 | else ( 91 | echo "Call QMake..." && 92 | qmake.exe -v && 93 | qmake.exe CONFIG+=%CONFIGURATION% ..\JKQtExtrasBuildAllExamples.pro && 94 | echo "Build..." && 95 | call %MAKETOOL% && 96 | cd ..) 97 | 98 | #artifacts: 99 | # - path: build\staticlib\**\*.a 100 | # name: staticlib %QTVER%%QTABI% 101 | # - path: build\sharedlib\**\*.a 102 | # name: sharedlib %QTVER%%QTABI% 103 | # - path: build\staticlib\**\*.lib 104 | # name: staticlib %QTVER%%QTABI% 105 | # - path: build\sharedlib\**\*.lib 106 | # name: sharedlib %QTVER%%QTABI% 107 | # - path: build\sharedlib\**\*.dll 108 | # name: dll %QTVER%%QTABI% 109 | 110 | 111 | 112 | # # remote desktop connection on init 113 | # init: 114 | # - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) 115 | 116 | # # remote desktop connection on finish and block build to not destroy VM 117 | # on_finish: 118 | # - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) 119 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqterecentfilesmenu.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License (GPL) as published by 6 | the Free Software Foundation, either version 3.0 of the License, or 7 | (at your option) any later version. 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | */ 15 | 16 | #ifndef JKQTERECENTFILESMENU_H 17 | #define JKQTERECENTFILESMENU_H 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include "jkqtextras_imexport.h" 27 | 28 | /*! \brief a special QMenu that allows to manage a list of recently loaded files 29 | \ingroup JKQtExtrasWidgetsMenus 30 | 31 | \image html JKQTERecentFilesMenu.png 32 | 33 | Usage example: 34 | 35 | \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTERecentFilesMenu 36 | */ 37 | class JKQTEXTRAS_LIB_EXPORT JKQTERecentFilesMenu : public QMenu { 38 | Q_OBJECT 39 | public: 40 | explicit JKQTERecentFilesMenu(QWidget *parent = 0); 41 | 42 | /** \brief set the max. number of files in the list */ 43 | void setMaxRecentFilesCount(int num); 44 | /** \brief returns the max. number of files in the list */ 45 | int maxRecentFilesCount() const; 46 | /** \brief show icons next to the recent files */ 47 | void setShowIcons(bool enabled); 48 | /** \brief show icons next to the recent files */ 49 | bool doesShowIcons() const; 50 | 51 | void setAlwaysEnabled(bool enabled); 52 | 53 | /** \brief register an icon for a given filetype this overrides the display of system icons */ 54 | void setIconForExtension(const QString& extension, const QIcon& icon); 55 | /** \brief set the default icon */ 56 | void setDefaultIcon(const QIcon& defaultIcon); 57 | /** \brief use file icons from system */ 58 | void setUseSystemFileIcons(bool use); 59 | 60 | /*! \brief save the list of recent files into a QSettings object. 61 | 62 | The settings are saved under the key 63 | \c [prefix] + "recentfilelist" 64 | */ 65 | void storeSettings(QSettings& settings, QString prefix=QString("")); 66 | /*! \brief read the list of recent files from a QSettings object. 67 | 68 | The settings are saved under the key 69 | \c [prefix] + "recentfilelist" 70 | */ 71 | void readSettings(QSettings& settings, QString prefix=QString("")); 72 | 73 | /** \brief add a new file to the list of recent files */ 74 | void addRecentFile(const QString& filename); 75 | /** \brief clear all recent files */ 76 | void clearRecentFiles(); 77 | 78 | signals: 79 | /** \brief emitted when the user clicks one of the recent files in the menu. */ 80 | void openRecentFile(const QString& filename); 81 | public slots: 82 | void setMenuEnabled(bool enabled); 83 | protected: 84 | bool alwaysDisabled; 85 | QList m_actions; 86 | QStringList m_files; 87 | QMap m_fileIcons; 88 | QIcon m_defaultIcon; 89 | bool m_useSystemFileIcons; 90 | bool m_icons; 91 | bool m_alwaysEnabled; 92 | QFileIconProvider iconProvider; 93 | QString strippedName(const QString &fullFileName); 94 | QIcon iconForFile(const QFileInfo& fileinfo); 95 | protected slots: 96 | void updateActions(); 97 | void intOpenRecentFile(); 98 | 99 | }; 100 | 101 | #endif // JKQTERECENTFILESMENU_H 102 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtextras_imexport.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JKQTEXTRAS_IMPORT_H 19 | #define JKQTEXTRAS_IMPORT_H 20 | 21 | 22 | 23 | 24 | /*! \def JKQTEXTRAS_LIB_EXPORT 25 | \ingroup JKQtExtras 26 | 27 | This define allows to export functions and classes from the jkqtcommon-library when building a dynamic/shared library. 28 | Usage is as follows: 29 | \code 30 | #include "jkqtextras/jkqtextras_imexport.h.h" 31 | 32 | class JKQTEXTRAS_LIB_EXPORT exportedClassName { 33 | ... 34 | }; 35 | 36 | JKQTEXTRAS_LIB_EXPORT void exportedFunctionName(); 37 | \endcode 38 | 39 | These macros append the appropriate \c __declspec(dllexport) and \c __declspec(dllimport) 40 | to the function/class body and thus tell windows compilers to export these sysmbols from 41 | the shared library, or import them from a shared library. 42 | 43 | Note that these attributes are only necessary on windows systems! 44 | 45 | These macros are controlled by two other macros: 46 | - \c JKQTEXTRAS_LIB_IN_DLL declares that the application should link against a shared version of 47 | JKQtExtras, i.e. \c JKQtExtrasSharedLib_XYZ . 48 | This needs to be defined while compiling the library and while compiling 49 | any application linking against \c JKQtExtrasSharedLib_XYZ. 50 | - \c JKQTEXTRAS_LIB_EXPORT_LIBRARY is only defined while compiling JKQtExtras into \c JKQtExtrasSharedLib_XYZ 51 | and ensures thet the symbols are exported. If it is not defined (e.g. while 52 | compiling an application), the symbols are imported 53 | . 54 | 55 | */ 56 | 57 | /*! \def JKQTEXTRAS_LIB_IN_DLL 58 | \ingroup JKQtExtras 59 | \brief declares that the application should link against a shared version of 60 | JKQtExtras, i.e. \c JKQtExtrasSharedLib_XYZ . 61 | This needs to be defined while compiling the library and while compiling 62 | any application linking against \c JKQtExtrasSharedLib_XYZ. 63 | */ 64 | 65 | /*! \def JKQTEXTRAS_LIB_EXPORT_LIBRARY 66 | \ingroup JKQtExtras 67 | \brief is only defined while compiling JKQtExtras into \c JKQtExtrasSharedLib_XYZ 68 | and ensures thet the symbols are exported. If it is not defined (e.g. while 69 | compiling an application), the symbols are imported 70 | */ 71 | 72 | # ifndef __WINDOWS__ 73 | # if defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32) 74 | # define __WINDOWS__ 75 | # endif 76 | # endif 77 | 78 | #ifdef __WINDOWS__ 79 | # ifdef JKQTEXTRAS_LIB_IN_DLL 80 | # ifndef JKQTEXTRAS_LIB_EXPORT 81 | # ifdef JKQTEXTRAS_LIB_EXPORT_LIBRARY 82 | /* We are building this library */ 83 | # define JKQTEXTRAS_LIB_EXPORT __declspec(dllexport) 84 | # else 85 | /* We are using this library */ 86 | # define JKQTEXTRAS_LIB_EXPORT __declspec(dllimport) 87 | # endif 88 | # endif 89 | # else 90 | # ifndef JKQTEXTRAS_LIB_EXPORT 91 | # define JKQTEXTRAS_LIB_EXPORT 92 | # endif 93 | # endif 94 | #else 95 | # define JKQTEXTRAS_LIB_EXPORT 96 | #endif 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | #endif // JKQTEXTRAS_IMPORT_H 105 | 106 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtecheckablestringlistmodel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include "jkqtecheckablestringlistmodel.h" 19 | #include 20 | JKQTECheckableStringListModel::JKQTECheckableStringListModel(QObject *parent) : 21 | QStringListModel(parent), 22 | m_editable(false), 23 | m_checkable(true) 24 | { 25 | m_check.clear(); 26 | } 27 | 28 | JKQTECheckableStringListModel::JKQTECheckableStringListModel(bool editable, bool checkable, QObject *parent) : 29 | QStringListModel(parent), 30 | m_editable(editable), 31 | m_checkable(checkable) 32 | { 33 | m_check.clear(); 34 | } 35 | 36 | void JKQTECheckableStringListModel::setChecked(int i) { 37 | m_check.insert(i); 38 | emit dataChanged(index(i, 0), index(i, 0)); 39 | } 40 | 41 | void JKQTECheckableStringListModel::setChecked(int i, bool c) { 42 | if (c) m_check.insert(i); 43 | else m_check.remove(i); 44 | emit dataChanged(index(i, 0), index(i, 0)); 45 | } 46 | 47 | void JKQTECheckableStringListModel::setUnChecked(int i) { 48 | m_check.remove(i); 49 | emit dataChanged(index(i, 0), index(i, 0)); 50 | } 51 | 52 | bool JKQTECheckableStringListModel::isChecked(int i) const { 53 | //qDebug()<) 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JKQTEVISIBLEHANDLESPLITTER_H 19 | #define JKQTEVISIBLEHANDLESPLITTER_H 20 | 21 | #include 22 | #include 23 | #include "jkqtextras_imexport.h" 24 | 25 | /*! \brief a QSplitter that has a really visible Splitter handle 26 | \ingroup JKQtExtrasWidgetsLayout 27 | 28 | This is a simple replacement for QSplitter, 29 | which only adds sime visual tweaks: 30 | - a better visible handle 31 | - a highlighting/hover effect 32 | - a changeable grip width 33 | . 34 | 35 | The splitter looks like this: 36 | \image html JKQTEVisibleHandleSplitter.png 37 | \image html JKQTEVisibleHandleSplitterHover.png 38 | 39 | Usage is simple: 40 | 41 | \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTEVisibleHandleSplitter 42 | 43 | */ 44 | class JKQTEXTRAS_LIB_EXPORT JKQTEVisibleHandleSplitter : public QSplitter { 45 | Q_OBJECT 46 | Q_PROPERTY(bool decorated READ decorated WRITE setDecorated USER true) 47 | Q_PROPERTY(bool hoverEffect READ hoverEffect WRITE setHoverEffect USER true) 48 | Q_PROPERTY(int gripWidth READ gripWidth WRITE setGripWidth USER true) 49 | public: 50 | explicit JKQTEVisibleHandleSplitter(Qt::Orientation orientation, QWidget *parent = nullptr); 51 | explicit JKQTEVisibleHandleSplitter(QWidget *parent = nullptr); 52 | /** \brief indicates whether the decoration of the handle is on or off (decoration is a roughed up surface area) */ 53 | bool decorated() const; 54 | /** \brief indicates whether the hover effect of the handle is on or off (hover effect highlights the handle when the mouse hovers over it) */ 55 | bool hoverEffect() const; 56 | /** \brief the width of the handle */ 57 | int gripWidth() const; 58 | public slots: 59 | /** \brief switches the decoration of the handle on or off (decoration is a roughed up surface area) */ 60 | void setDecorated(bool enabled); 61 | /** \brief switches the hover effect of the handle on or off (hover effect highlights the handle when the mouse hovers over it) */ 62 | void setHoverEffect(bool enabled); 63 | /** \brief sets the width of the handle */ 64 | void setGripWidth(int width); 65 | signals: 66 | 67 | public slots: 68 | 69 | protected: 70 | QSplitterHandle *createHandle(); 71 | 72 | }; 73 | 74 | 75 | 76 | /*! \brief a QSplitterHandle that is really visible Splitter handle (used by JKQTEVisibleHandleSplitter) 77 | \ingroup JKQtExtrasWidgetsLayout 78 | 79 | \see JKQTEVisibleHandleSplitter 80 | 81 | */ 82 | class JKQTEXTRAS_LIB_EXPORT JKQTEVisibleHandleSplitterHandle: public QSplitterHandle { 83 | Q_OBJECT 84 | public: 85 | JKQTEVisibleHandleSplitterHandle(Qt::Orientation orientation, QSplitter * parent=nullptr); 86 | /** \brief switches the decoration of the handle on or off (decoration is a roughed up surface area) */ 87 | void setDecorated(bool enabled); 88 | /** \brief indicates whether the decoration of the handle is on or off (decoration is a roughed up surface area) */ 89 | bool decorated() const; 90 | /** \brief switches the hover effect of the handle on or off (hover effect highlights the handle when the mouse hovers over it) */ 91 | void setHoverEffect(bool enabled); 92 | /** \brief indicates whether the hover effect of the handle is on or off (hover effect highlights the handle when the mouse hovers over it) */ 93 | bool hoverEffect() const; 94 | /** \brief sets the width of the handle */ 95 | void setGripWidth(int width); 96 | /** \brief the width of the handle */ 97 | int gripWidth() const; 98 | protected: 99 | virtual void leaveEvent(QEvent* event); 100 | virtual void enterEvent(QEvent* event); 101 | virtual void paintEvent(QPaintEvent* event); 102 | int m_gripHeight; 103 | bool m_inside; 104 | bool m_lightup; 105 | bool m_drawGrip; 106 | }; 107 | 108 | #endif // JKQTEVISIBLEHANDLESPLITTER_H 109 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtestarratingwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JKQTESTARRATINGWIDGET_H 19 | #define JKQTESTARRATINGWIDGET_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include "jkqtextras_imexport.h" 27 | 28 | /*! \brief a rating widget which displays five stars where the user may select how many are selected 29 | \ingroup JKQtExtrasWidgetsLabels 30 | 31 | Screenshot: 32 | \image html JKQTEStarRatingWidget.png 33 | 34 | Basic usage is simple: 35 | 36 | \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTEStarRatingWidget 37 | 38 | You can set the images/icons to be used for present/unpresent stars and the limiter to the 39 | left that allows to set rating 0 when clicked: 40 | - setStarImage() 41 | - setDarkStarImage() 42 | - setNoStarImage() 43 | . 44 | 45 | */ 46 | class JKQTEXTRAS_LIB_EXPORT JKQTEStarRatingWidget : public QFrame { 47 | Q_OBJECT 48 | Q_PROPERTY(int data READ rating WRITE setRating ) 49 | Q_PROPERTY(int rating READ rating WRITE setRating USER true) 50 | Q_PROPERTY(QPixmap darkStarImage READ darkStarImage WRITE setDarkStarImage USER true) 51 | Q_PROPERTY(QPixmap starImage READ starImage WRITE setStarImage USER true) 52 | Q_PROPERTY(QPixmap noStarImage READ noStarImage WRITE setNoStarImage USER true) 53 | public: 54 | /** Default constructor */ 55 | JKQTEStarRatingWidget(QWidget* parent=NULL); 56 | /** Default destructor */ 57 | virtual ~JKQTEStarRatingWidget(); 58 | /** \brief returns the current rating (between 0 and maximum() ) */ 59 | int rating() const; 60 | /** \brief returns the current maximum rating */ 61 | int maximum() const; 62 | /** \brief the pixmap to use for a selected star */ 63 | QPixmap starImage() const; 64 | /** \brief the pixmap to use for no stars at all (rating() \c ==0 ) */ 65 | QPixmap noStarImage() const; 66 | /** \brief the pixmap to use for an unselected star */ 67 | QPixmap darkStarImage() const; 68 | 69 | public slots: 70 | /** \brief sets the pixmap to use for a selected star */ 71 | void setStarImage(const QPixmap &starImage); 72 | /** \brief sets the pixmap to use for no stars at all (rating() \c ==0 ) */ 73 | void setNoStarImage(const QPixmap &noStarImage); 74 | /** \brief sets the pixmap to use for an unselected star */ 75 | void setDarkStarImage(const QPixmap &darkStarImage); 76 | /** \brief sets the current rating (between 0 and maximum() ) */ 77 | void setRating(int value); 78 | /** \brief sets the current maximum rating */ 79 | void setMaximum(int value); 80 | /** \brief sets the frame style of the widget (see QFrame::setFrameStyle()) */ 81 | void setFrameStyle(int); 82 | /** \brief sets the frame shape of the widget (see QFrame::setFrameShape()) */ 83 | void setFrameShape(Shape); 84 | /** \brief sets the frame shadow of the widget (see QFrame::setFrameShadow()) */ 85 | void setFrameShadow(Shadow); 86 | /** \brief sets the frame line width of the widget (see QFrame::setLineWidth()) */ 87 | void setLineWidth(int); 88 | /** \brief sets the frame mid line width of the widget (see QFrame::setMidLineWidth()) */ 89 | void setMidLineWidth(int); 90 | /** \brief sets the frame rectangle of the widget (see QFrame::setFrameRect()) */ 91 | void setFrameRect(const QRect &); 92 | signals: 93 | /** \brief signal emitted when the rating changes */ 94 | void ratingChanged(int rating); 95 | protected: 96 | QPixmap m_starImage; 97 | QPixmap m_noStarImage; 98 | QPixmap m_darkStarImage; 99 | int m_rating; 100 | int m_maximum; 101 | void setWidgetSizes(); 102 | virtual void paintEvent ( QPaintEvent * event ); 103 | virtual void mouseReleaseEvent ( QMouseEvent * event ); 104 | private: 105 | }; 106 | 107 | #endif // JKQTESTARRATINGWIDGET_H 108 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtestarratingwidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include "jkqtestarratingwidget.h" 20 | #include 21 | #include 22 | 23 | JKQTEStarRatingWidget::JKQTEStarRatingWidget(QWidget* parent): 24 | QFrame(parent) 25 | { 26 | Q_INIT_RESOURCE(jkqtestarratingwidget); 27 | m_starImage= QPixmap(":/jkqtestarratingwidget/star.png"); 28 | m_darkStarImage=QPixmap(":/jkqtestarratingwidget/darkstar.png"); 29 | m_noStarImage= QPixmap(":/jkqtestarratingwidget/nostar.png"); 30 | m_rating=0; 31 | m_maximum=5; 32 | setWidgetSizes(); 33 | setFocusPolicy(Qt::ClickFocus); 34 | setFrameStyle(QFrame::Box | QFrame::Plain); 35 | setLineWidth(1); 36 | setMidLineWidth(0); 37 | } 38 | 39 | JKQTEStarRatingWidget::~JKQTEStarRatingWidget() 40 | { 41 | //dtor 42 | } 43 | 44 | int JKQTEStarRatingWidget::rating() const { 45 | return m_rating; 46 | } 47 | 48 | void JKQTEStarRatingWidget::setRating(int value) { 49 | m_rating=qBound(0,value,m_maximum); 50 | setWidgetSizes(); 51 | repaint(); 52 | emit ratingChanged(rating()); 53 | } 54 | 55 | int JKQTEStarRatingWidget::maximum() const { 56 | return m_maximum; 57 | } 58 | 59 | void JKQTEStarRatingWidget::setMaximum(int value) { 60 | m_maximum=value; 61 | m_rating=qBound(0,rating(),m_maximum); 62 | setWidgetSizes(); 63 | repaint(); 64 | emit ratingChanged(rating()); 65 | } 66 | 67 | void JKQTEStarRatingWidget::setWidgetSizes() { 68 | QSize s((m_starImage.width()+2)*m_maximum+m_noStarImage.width()+4+2*frameWidth(), qMax(m_starImage.height(), m_noStarImage.height())+4+2*frameWidth()); 69 | setMaximumSize(s); 70 | setMinimumSize(s); 71 | resize(s); 72 | } 73 | 74 | void JKQTEStarRatingWidget::paintEvent(QPaintEvent * event) { 75 | QFrame::paintEvent(event); 76 | QPainter painter(this); 77 | int startx=2+frameWidth(); 78 | int starty=2+frameWidth(); 79 | painter.drawPixmap(startx, starty,m_noStarImage); 80 | int x=m_noStarImage.width()+startx; 81 | //QPen p(palette().color(QPalette::Dark)); 82 | //painter.setPen(p); 83 | //painter.drawRect(0,0,width()-1, height()-1); 84 | for (int i=1; i<=m_maximum; i++) { 85 | if (m_rating>=i) painter.drawPixmap(x+1,starty,m_starImage); 86 | else painter.drawPixmap(x+1,starty,m_darkStarImage); 87 | x=x+m_starImage.width()+2; 88 | } 89 | /*if (hasFocus()) { 90 | p.setStyle(Qt::DotLine); 91 | p.setColor(palette().color(QPalette::Light)); 92 | painter.setPen(p); 93 | painter.drawRect(0,0,width()-1, height()-1); 94 | }*/ 95 | } 96 | 97 | void JKQTEStarRatingWidget::mouseReleaseEvent(QMouseEvent * event) { 98 | if (event->button()==Qt::LeftButton) { 99 | int n_rating=0; 100 | //int startx=2+frameWidth(); 101 | int starty=2+frameWidth(); 102 | //std::cout<<"button(x="<x()<<", "<y()<<")\n"; 103 | if (event->x()<=m_noStarImage.width()+starty) n_rating=0; 104 | else { 105 | int x=m_noStarImage.width()+starty;//+starImage.width()+1; 106 | n_rating=(event->x()-x)/(m_starImage.width()+2)+1; 107 | } 108 | event->accept(); 109 | //std::cout<<"new rating="< 77 | $ 78 | ) 79 | set_target_properties(${libsh_name} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS "ON") 80 | write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake 81 | VERSION ${PROJECT_VERSION} 82 | COMPATIBILITY AnyNewerVersion ) 83 | endif() 84 | 85 | if(JKQtExtras_BUILD_STATIC_LIBS) 86 | add_library(${lib_name} STATIC ${SOURCES} ${SOURCES_GRAPHS} ${SOURCES_GUI} ${SOURCES_OVERLAYS} ${HEADERS} ${HEADERS_GRAPHS} ${HEADERS_GUI} ${HEADERS_OVERLAYS} ${RESOURCES}) 87 | target_compile_features(${lib_name} PUBLIC cxx_std_11) 88 | set_property(TARGET ${lib_name} PROPERTY VERSION "${PROJECT_VERSION}") 89 | set_property(TARGET ${lib_name} PROPERTY OUTPUT_NAME "${lib_name_decorated}") 90 | target_include_directories(${lib_name} PUBLIC 91 | $ 92 | $ 93 | ) 94 | target_link_libraries(${lib_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::Svg Qt5::Xml ) 95 | write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake 96 | VERSION ${PROJECT_VERSION} 97 | COMPATIBILITY AnyNewerVersion ) 98 | endif() 99 | 100 | 101 | 102 | # Installation 103 | if(JKQtExtras_BUILD_SHARED_LIBS) 104 | install(TARGETS ${libsh_name} EXPORT ${libsh_name}_TARGETS 105 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 106 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 107 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 108 | INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 109 | ) 110 | install(EXPORT ${libsh_name}_TARGETS 111 | FILE ${libsh_name}Config.cmake 112 | DESTINATION lib/cmake/${libsh_name} 113 | ) 114 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libsh_name}Version.cmake" 115 | DESTINATION lib/cmake/${libsh_name} ) 116 | endif(JKQtExtras_BUILD_SHARED_LIBS) 117 | 118 | if(JKQtExtras_BUILD_STATIC_LIBS) 119 | install(TARGETS ${lib_name} EXPORT ${lib_name}_TARGETS 120 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 121 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 122 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 123 | INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 124 | ) 125 | install(EXPORT ${lib_name}_TARGETS 126 | FILE ${lib_name}Config.cmake 127 | DESTINATION lib/cmake/${lib_name} 128 | ) 129 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake" 130 | DESTINATION lib/cmake/${lib_name} ) 131 | endif(JKQtExtras_BUILD_STATIC_LIBS) 132 | 133 | install(FILES ${HEADERS} 134 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir} 135 | COMPONENT Headers) 136 | 137 | configure_file(${CMAKE_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY) 138 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt" DESTINATION doc/ ) 139 | install(FILES "${CMAKE_SOURCE_DIR}/LICENSE" DESTINATION doc/ RENAME "${lib_name}_LICENSE.txt" ) 140 | 141 | 142 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtevisiblehandlesplitter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include "jkqtevisiblehandlesplitter.h" 19 | #include 20 | #include 21 | 22 | JKQTEVisibleHandleSplitterHandle::JKQTEVisibleHandleSplitterHandle(Qt::Orientation orientation, QSplitter * parent) : 23 | QSplitterHandle(orientation, parent) 24 | { 25 | m_gripHeight=96; 26 | m_inside=false; 27 | m_lightup=true; 28 | m_drawGrip=true; 29 | setMouseTracking(true); 30 | } 31 | 32 | 33 | void JKQTEVisibleHandleSplitterHandle::paintEvent(QPaintEvent *event) 34 | { 35 | 36 | QBrush back=QBrush(palette().brush(QPalette::Light)); 37 | QPen lines=palette().color(QPalette::Mid); 38 | if (m_lightup && m_inside) { 39 | QPainter painter(this); 40 | back= QBrush(palette().brush(QPalette::Highlight)); 41 | painter.fillRect(event->rect(), back); 42 | back.setColor(back.color().lighter()); 43 | lines.setColor(back.color().darker()); 44 | } else { 45 | //painter.fillRect(event->rect(), QBrush(palette().brush(QPalette::Window))); 46 | QSplitterHandle::paintEvent(event); 47 | } 48 | QPainter painter(this); 49 | if (m_drawGrip) { 50 | if (orientation() == Qt::Horizontal) {// WIDGET | WIDGET | WIDGET 51 | QRect r=event->rect(); 52 | QRect grip=QRect(r.left(), r.center().y()-m_gripHeight/2, r.width(), m_gripHeight); 53 | painter.fillRect(grip, back); 54 | painter.setPen(lines); 55 | for (int i=grip.top(); irect(); 65 | QRect grip=QRect(r.center().x()-m_gripHeight/2, r.top(), m_gripHeight, r.height()); 66 | painter.fillRect(grip, back); 67 | painter.setPen(lines); 68 | for (int i=grip.left(); i(handle(i)); 106 | if (h) return h->decorated(); 107 | } 108 | return false; 109 | } 110 | 111 | bool JKQTEVisibleHandleSplitter::hoverEffect() const 112 | { 113 | for (int i=0;i(handle(i)); 115 | if (h) return h->hoverEffect(); 116 | } 117 | return false; 118 | } 119 | 120 | int JKQTEVisibleHandleSplitter::gripWidth() const 121 | { 122 | for (int i=0;i(handle(i)); 124 | if (h) return h->gripWidth(); 125 | } 126 | return 0; 127 | } 128 | 129 | QSplitterHandle* JKQTEVisibleHandleSplitter::createHandle() { 130 | return new JKQTEVisibleHandleSplitterHandle(orientation(), this); 131 | } 132 | 133 | void JKQTEVisibleHandleSplitter::setDecorated(bool enabled) { 134 | for (int i=0;i(handle(i)); 136 | if (h) h->setDecorated(enabled); 137 | } 138 | } 139 | 140 | void JKQTEVisibleHandleSplitter::setHoverEffect(bool enabled) { 141 | for (int i=0;i(handle(i)); 143 | if (h) h->setHoverEffect(enabled); 144 | } 145 | } 146 | void JKQTEVisibleHandleSplitter::setGripWidth(int width) { 147 | for (int i=0;i(handle(i)); 149 | if (h) h->setGripWidth(width); 150 | } 151 | } 152 | 153 | void JKQTEVisibleHandleSplitterHandle::setDecorated(bool enabled) { m_drawGrip=enabled; } 154 | 155 | bool JKQTEVisibleHandleSplitterHandle::decorated() const { return m_drawGrip; } 156 | 157 | void JKQTEVisibleHandleSplitterHandle::setHoverEffect(bool enabled) { m_lightup=enabled; } 158 | 159 | void JKQTEVisibleHandleSplitterHandle::setGripWidth(int width) { m_gripHeight=width; } 160 | 161 | int JKQTEVisibleHandleSplitterHandle::gripWidth() const { return m_gripHeight; } 162 | 163 | bool JKQTEVisibleHandleSplitterHandle::hoverEffect() const { return m_lightup; } 164 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqterecentfilesmenu.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License (GPL) as published by 6 | the Free Software Foundation, either version 3.0 of the License, or 7 | (at your option) any later version. 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | */ 15 | 16 | #include "jkqterecentfilesmenu.h" 17 | #include 18 | #include 19 | 20 | JKQTERecentFilesMenu::JKQTERecentFilesMenu(QWidget *parent) : 21 | QMenu(parent) 22 | { 23 | setTitle(tr("Recent Files ...")); 24 | setMaxRecentFilesCount(20); 25 | m_useSystemFileIcons=true; 26 | m_icons=true; 27 | m_defaultIcon=QIcon(); 28 | m_alwaysEnabled=false; 29 | m_fileIcons.clear(); 30 | alwaysDisabled=false; 31 | } 32 | 33 | void JKQTERecentFilesMenu::setMaxRecentFilesCount(int num) { 34 | if (m_actions.count()>num) { 35 | for (int i=m_actions.count()-1; i>=num; i--) { 36 | removeAction(m_actions[i]); 37 | delete m_actions[i]; 38 | m_actions.pop_back(); 39 | } 40 | } else if (m_actions.count()setVisible(false); 44 | connect(act, SIGNAL(triggered()), this, SLOT(intOpenRecentFile())); 45 | m_actions.append(act); 46 | addAction(act); 47 | } 48 | } 49 | } 50 | 51 | int JKQTERecentFilesMenu::maxRecentFilesCount() const { 52 | return m_actions.count(); 53 | } 54 | 55 | void JKQTERecentFilesMenu::setShowIcons(bool enabled) { 56 | m_icons=enabled; 57 | updateActions(); 58 | } 59 | 60 | bool JKQTERecentFilesMenu::doesShowIcons() const { 61 | return m_icons; 62 | } 63 | 64 | void JKQTERecentFilesMenu::setAlwaysEnabled(bool enabled) { 65 | m_alwaysEnabled=enabled; 66 | updateActions(); 67 | } 68 | 69 | void JKQTERecentFilesMenu::setIconForExtension(const QString &extension, const QIcon &icon) { 70 | m_fileIcons[extension]=icon; 71 | updateActions(); 72 | } 73 | 74 | void JKQTERecentFilesMenu::storeSettings(QSettings &settings, QString prefix) { 75 | settings.setValue(prefix+QString("recentfilelist"), m_files); 76 | //settings.setValue(prefix+QString("recentfilelist_max"), maxRecentFilesCount()); 77 | } 78 | 79 | void JKQTERecentFilesMenu::readSettings(QSettings &settings, QString prefix) { 80 | //setMaxRecentFilesCount(settings.value(prefix+QString("recentfilelist_max"), maxRecentFilesCount()).toInt()); 81 | m_files=settings.value(prefix+QString("recentfilelist")).toStringList(); 82 | m_files.removeDuplicates(); 83 | if (m_files.size()>0) for (int j = m_files.size()-1; j >=0 ; j--) { 84 | if (m_files[j].trimmed().isEmpty()) { 85 | m_files.removeAt(j); 86 | } 87 | } 88 | while (m_files.size()>maxRecentFilesCount()) { 89 | m_files.pop_back(); 90 | } 91 | updateActions(); 92 | } 93 | 94 | void JKQTERecentFilesMenu::addRecentFile(const QString &filename) { 95 | m_files.removeDuplicates(); 96 | if (m_files.size()>0) for (int j = m_files.size()-1; j >=0 ; j--) { 97 | if (m_files[j].trimmed().isEmpty()) { 98 | m_files.removeAt(j); 99 | } 100 | } 101 | m_files.removeAll(filename); 102 | m_files.prepend(filename); 103 | while (m_files.size()>maxRecentFilesCount()) { 104 | m_files.pop_back(); 105 | } 106 | updateActions(); 107 | } 108 | 109 | void JKQTERecentFilesMenu::clearRecentFiles() { 110 | m_files.clear(); 111 | updateActions(); 112 | } 113 | 114 | void JKQTERecentFilesMenu::updateActions() { 115 | int numRecentFiles = qMin(m_files.size(), (int)maxRecentFilesCount()); 116 | for (int i = 0; i < numRecentFiles; ++i) { 117 | QString text = tr("&%1 %2").arg(i + 1).arg(strippedName(m_files[i])); 118 | m_actions[i]->setText(text); 119 | m_actions[i]->setToolTip(m_files[i]); 120 | m_actions[i]->setData(m_files[i]); 121 | m_actions[i]->setIcon(iconForFile(QFileInfo(m_files[i]))); 122 | m_actions[i]->setVisible(true); 123 | } 124 | for (int i=numRecentFiles; isetText(""); 126 | m_actions[i]->setData(""); 127 | m_actions[i]->setToolTip(""); 128 | m_actions[i]->setVisible(false); 129 | m_actions[i]->setIcon(QIcon()); 130 | } 131 | if (alwaysDisabled) setEnabled(false); 132 | else { 133 | if (numRecentFiles<=0) setEnabled(m_alwaysEnabled); 134 | else setEnabled(true); 135 | } 136 | } 137 | 138 | void JKQTERecentFilesMenu::intOpenRecentFile() { 139 | QAction *action = qobject_cast(sender()); 140 | if (action) { 141 | emit openRecentFile(action->data().toString()); 142 | } 143 | } 144 | 145 | QString JKQTERecentFilesMenu::strippedName(const QString &fullFileName) { 146 | return QFileInfo(fullFileName).fileName(); 147 | } 148 | 149 | QIcon JKQTERecentFilesMenu::iconForFile(const QFileInfo &fileinfo) { 150 | if (m_icons) { 151 | if (m_fileIcons.contains(fileinfo.completeSuffix().toLower())) { 152 | return m_fileIcons[fileinfo.completeSuffix().toLower()]; 153 | } 154 | if (m_useSystemFileIcons) { 155 | return iconProvider.icon(fileinfo); 156 | } 157 | return m_defaultIcon; 158 | } else { 159 | return QIcon(); 160 | } 161 | } 162 | 163 | void JKQTERecentFilesMenu::setUseSystemFileIcons(bool use) { 164 | m_useSystemFileIcons=use; 165 | } 166 | 167 | void JKQTERecentFilesMenu::setDefaultIcon(const QIcon &defaultIcon) { 168 | m_defaultIcon=defaultIcon; 169 | } 170 | 171 | void JKQTERecentFilesMenu::setMenuEnabled(bool enabled) 172 | { 173 | alwaysDisabled=!enabled; 174 | updateActions(); 175 | } 176 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtespecialtoolbutton.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as 6 | published by the Free Software Foundation, either version 2.1 of the License, 7 | or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | (LGPL) along with this program. If not, see . 16 | */ 17 | 18 | #include "jkqtespecialtoolbutton.h" 19 | 20 | JKQTEURLOpenToolButton::JKQTEURLOpenToolButton(QWidget* parent): 21 | QToolButton(parent) 22 | { 23 | Q_INIT_RESOURCE(jkqtespecialtoolbutton); 24 | this->connect(this, SIGNAL(clicked()), this, SLOT(openBuddyContents())); 25 | setIcon(QIcon(tr(":/jkqtespecialtoolbutton/urltoolbutton.png"))); 26 | } 27 | 28 | JKQTEURLOpenToolButton::~JKQTEURLOpenToolButton() 29 | { 30 | disconnect(this, SIGNAL(clicked()), this, SLOT(openBuddyContents())); 31 | } 32 | 33 | const QLineEdit *JKQTEURLOpenToolButton::buddy() const { 34 | return m_buddy; 35 | } 36 | 37 | QLineEdit *JKQTEURLOpenToolButton::buddy() { 38 | return m_buddy; 39 | } 40 | 41 | void JKQTEURLOpenToolButton::setBuddy(QLineEdit *b) 42 | { 43 | m_buddy=b; 44 | } 45 | 46 | void JKQTEURLOpenToolButton::openBuddyContents() { 47 | if (m_buddy==NULL) return; 48 | QString a=m_buddy->text(); 49 | QDesktopServices::openUrl(QUrl(a, QUrl::TolerantMode)); 50 | } 51 | 52 | 53 | 54 | JKQTEDirectorySelectToolButton::JKQTEDirectorySelectToolButton(QWidget* parent): 55 | QToolButton(parent), 56 | m_buddy(nullptr), 57 | m_baseDir(), 58 | m_dlgTitle(tr("Select Directory ...")) 59 | { 60 | Q_INIT_RESOURCE(jkqtespecialtoolbutton); 61 | Q_INIT_RESOURCE(jkqtespecialtoolbutton); 62 | this->connect(this, SIGNAL(clicked()), this, SLOT(openBuddyContents())); 63 | setIcon(QIcon(tr(":jkqtespecialtoolbutton/dirselecttoolbutton.png"))); 64 | } 65 | 66 | JKQTEDirectorySelectToolButton::~JKQTEDirectorySelectToolButton() 67 | { 68 | disconnect(this, SIGNAL(clicked()), this, SLOT(openBuddyContents())); 69 | } 70 | 71 | const QLineEdit *JKQTEDirectorySelectToolButton::buddy() const { 72 | return m_buddy; 73 | } 74 | 75 | QLineEdit *JKQTEDirectorySelectToolButton::buddy() { 76 | return m_buddy; 77 | } 78 | 79 | void JKQTEDirectorySelectToolButton::setBuddy(QLineEdit *b) 80 | { 81 | m_buddy=b; 82 | } 83 | 84 | void JKQTEDirectorySelectToolButton::setBaseDir(const QString &b) { 85 | m_baseDir=b; 86 | } 87 | 88 | QString JKQTEDirectorySelectToolButton::getBaseDir() const 89 | { 90 | return m_baseDir; 91 | } 92 | 93 | QString JKQTEDirectorySelectToolButton::getDialogTitle() const 94 | { 95 | return m_dlgTitle; 96 | } 97 | 98 | void JKQTEDirectorySelectToolButton::setDialogFilter(const QString &b) 99 | { 100 | m_dlgFilter=b; 101 | } 102 | 103 | 104 | void JKQTEDirectorySelectToolButton::openBuddyContents() { 105 | if (m_buddy==NULL) return; 106 | static QString dir=""; 107 | QString dirName = QFileDialog::getExistingDirectory(this, m_dlgTitle, dir, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); 108 | if (!dirName.isEmpty()) { 109 | dir=QDir(dirName).absolutePath(); 110 | 111 | m_buddy->setText(QDir((m_baseDir.isEmpty())?QDir::currentPath():m_baseDir).relativeFilePath( dirName)); 112 | m_buddy->setFocus(Qt::MouseFocusReason); 113 | } 114 | } 115 | 116 | 117 | 118 | 119 | JKQTEFileSelectToolButton::JKQTEFileSelectToolButton(QWidget* parent): 120 | QToolButton(parent), 121 | m_buddy(nullptr), 122 | m_baseDir(), 123 | m_dlgTitle(tr("Select File ...")), 124 | m_dlgFilter(tr("All Files (*.*)")) 125 | { 126 | Q_INIT_RESOURCE(jkqtespecialtoolbutton); 127 | this->connect(this, SIGNAL(clicked()), this, SLOT(openBuddyContents())); 128 | setIcon(QIcon(tr(":/jkqtespecialtoolbutton/fileselecttoolbutton.png"))); 129 | } 130 | 131 | JKQTEFileSelectToolButton::~JKQTEFileSelectToolButton() 132 | { 133 | disconnect(this, SIGNAL(clicked()), this, SLOT(openBuddyContents())); 134 | } 135 | 136 | const QLineEdit *JKQTEFileSelectToolButton::buddy() const { 137 | return m_buddy; 138 | } 139 | 140 | QLineEdit *JKQTEFileSelectToolButton::buddy() { 141 | return m_buddy; 142 | } 143 | 144 | void JKQTEFileSelectToolButton::setBuddy(QLineEdit *b) 145 | { 146 | m_buddy=b; 147 | } 148 | 149 | void JKQTEFileSelectToolButton::setBaseDir(const QString &b) { 150 | m_baseDir=b; 151 | } 152 | 153 | QString JKQTEFileSelectToolButton::getBaseDir() const 154 | { 155 | return m_baseDir; 156 | } 157 | 158 | void JKQTEFileSelectToolButton::setDialogTitle(const QString &b) 159 | { 160 | m_dlgTitle=b; 161 | } 162 | 163 | QString JKQTEFileSelectToolButton::getDialogTitle() const 164 | { 165 | return m_dlgTitle; 166 | } 167 | 168 | void JKQTEFileSelectToolButton::setDialogFilter(const QString &b) 169 | { 170 | m_dlgFilter=b; 171 | } 172 | 173 | QString JKQTEFileSelectToolButton::getDialogFilter() const 174 | { 175 | return m_dlgFilter; 176 | } 177 | 178 | void JKQTEFileSelectToolButton::openBuddyContents() { 179 | if (m_buddy==NULL) return; 180 | static QString dir=""; 181 | QString fileName = QFileDialog::getOpenFileName(this, m_dlgTitle, dir, m_dlgFilter); 182 | if (!fileName.isEmpty()) { 183 | dir=QFileInfo(fileName).dir().absolutePath(); 184 | 185 | m_buddy->setText(QDir((m_baseDir.isEmpty())?QDir::currentPath():m_baseDir).relativeFilePath( fileName)); 186 | m_buddy->setFocus(Qt::MouseFocusReason); 187 | } 188 | } 189 | 190 | 191 | 192 | JKQTEFileExecuteToolButton::JKQTEFileExecuteToolButton(QWidget* parent): 193 | QToolButton(parent), 194 | m_buddy(nullptr), 195 | m_baseDir() 196 | { 197 | this->connect(this, SIGNAL(clicked()), this, SLOT(openBuddyContents())); 198 | setIcon(QIcon(tr(":/jkqtespecialtoolbutton/executetoolbutton.png"))); 199 | } 200 | 201 | JKQTEFileExecuteToolButton::~JKQTEFileExecuteToolButton() 202 | { 203 | disconnect(this, SIGNAL(clicked()), this, SLOT(openBuddyContents())); 204 | } 205 | 206 | const QLineEdit *JKQTEFileExecuteToolButton::buddy() const { 207 | return m_buddy; 208 | } 209 | 210 | QLineEdit *JKQTEFileExecuteToolButton::buddy() { 211 | return m_buddy; 212 | } 213 | 214 | void JKQTEFileExecuteToolButton::setBuddy(QLineEdit *b) { 215 | m_buddy=b; 216 | } 217 | 218 | void JKQTEFileExecuteToolButton::setBaseDir(const QString &b) { 219 | m_baseDir=b; 220 | } 221 | 222 | QString JKQTEFileExecuteToolButton::getBaseDir() const 223 | { 224 | return m_baseDir; 225 | } 226 | 227 | void JKQTEFileExecuteToolButton::openBuddyContents() { 228 | if (m_buddy==NULL) return; 229 | QString a=QDir::cleanPath (QDir((m_baseDir.isEmpty())?QDir::currentPath():m_baseDir).absoluteFilePath( m_buddy->text())); 230 | //std::cout<<"executing: "<) 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as 6 | published by the Free Software Foundation, either version 2.1 of the License, 7 | or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | (LGPL) along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JKQTESPECIALTOOLBUTTON_H 19 | #define JKQTESPECIALTOOLBUTTON_H 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include "jkqtextras_imexport.h" 30 | 31 | 32 | 33 | 34 | /** \brief specialized QToolButton which takes the contents of its buddy as webpage adress (URL) and opens 35 | * it in the system's standard application 36 | * \ingroup JKQtExtrasWidgetsButtons 37 | * 38 | * \image html JKQTEURLOpenToolButton.png 39 | * 40 | * Usage example: 41 | * 42 | * \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTEURLOpenToolButton 43 | */ 44 | class JKQTEXTRAS_LIB_EXPORT JKQTEURLOpenToolButton : public QToolButton { 45 | Q_OBJECT 46 | public: 47 | /** Default constructor */ 48 | JKQTEURLOpenToolButton(QWidget* parent=nullptr); 49 | /** Default destructor */ 50 | virtual ~JKQTEURLOpenToolButton(); 51 | 52 | /** \brief buddy associated with this button */ 53 | const QLineEdit* buddy() const; 54 | /** \brief buddy associated with this button */ 55 | QLineEdit* buddy() ; 56 | /** \brief set the buddy widget, which provides the contents */ 57 | void setBuddy(QLineEdit* b); 58 | protected slots: 59 | /** \brief opens the contents of the buddy() as URL 60 | * 61 | * This internally calls \c QDesktopServices::openUrl(QUrl(buddyContents,QUrl::TolerantMode)); 62 | */ 63 | void openBuddyContents(); 64 | private: 65 | QLineEdit* m_buddy; 66 | }; 67 | 68 | 69 | /** \brief specialized QToolButton which allows to select a file and saves its path in the buddy 70 | * \ingroup JKQtExtrasWidgetsButtons 71 | * 72 | * \image html JKQTEFileSelectToolButton.png 73 | * 74 | * Usage example: 75 | * 76 | * \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTEFileSelectToolButton 77 | */ 78 | class JKQTEXTRAS_LIB_EXPORT JKQTEFileSelectToolButton : public QToolButton { 79 | Q_OBJECT 80 | public: 81 | /** Default constructor */ 82 | JKQTEFileSelectToolButton(QWidget* parent=nullptr); 83 | /** Default destructor */ 84 | virtual ~JKQTEFileSelectToolButton(); 85 | 86 | /** \brief buddy associated with this button */ 87 | const QLineEdit* buddy() const; 88 | /** \brief buddy associated with this button */ 89 | QLineEdit* buddy() ; 90 | /** \brief set the buddy widget, which provides the contents */ 91 | void setBuddy(QLineEdit* b); 92 | /** \brief returns a basedir in which files are searched for execution, if this is empty the current directory is used */ 93 | QString getBaseDir() const; 94 | /** \brief returns the title label of the file select dialog*/ 95 | QString getDialogTitle() const; 96 | /** \brief returns the file filter of the file select dialog*/ 97 | QString getDialogFilter() const; 98 | public slots: 99 | /** \brief sets the file filter of the file select dialog*/ 100 | void setDialogFilter(const QString &b); 101 | /** \brief sets the title label of the file select dialog*/ 102 | void setDialogTitle(const QString& b); 103 | /** \brief set a basedir in which files are searched for execution, if this is empty the current directory is used */ 104 | void setBaseDir(const QString& b); 105 | protected slots: 106 | void openBuddyContents(); 107 | private: 108 | QLineEdit* m_buddy; 109 | QString m_baseDir; 110 | QString m_dlgTitle; 111 | QString m_dlgFilter; 112 | }; 113 | 114 | 115 | /** \brief specialized QToolButton which allows to select a directory and saves its path in the buddy 116 | * \ingroup JKQtExtrasWidgetsButtons 117 | * 118 | * \image html JKQTEDirectorySelectToolButton.png 119 | * 120 | * Usage example: 121 | * 122 | * \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTEDirectorySelectToolButton 123 | */ 124 | class JKQTEXTRAS_LIB_EXPORT JKQTEDirectorySelectToolButton : public QToolButton { 125 | Q_OBJECT 126 | public: 127 | /** Default constructor */ 128 | JKQTEDirectorySelectToolButton(QWidget* parent=nullptr); 129 | /** Default destructor */ 130 | virtual ~JKQTEDirectorySelectToolButton(); 131 | 132 | /** \brief buddy associated with this button */ 133 | const QLineEdit* buddy() const; 134 | /** \brief buddy associated with this button */ 135 | QLineEdit* buddy() ; 136 | /** \brief set the buddy widget, which provides the contents */ 137 | void setBuddy(QLineEdit* b); 138 | /** \brief returns a basedir in which files are searched for execution, if this is empty the current directory is used */ 139 | QString getBaseDir() const; 140 | /** \brief returns the title label of the file select dialog*/ 141 | QString getDialogTitle() const; 142 | public slots: 143 | /** \brief sets the file filter of the file select dialog*/ 144 | void setDialogFilter(const QString &b); 145 | /** \brief set a basedir in which files are searched for execution, if this is empty the current directory is used */ 146 | void setBaseDir(const QString& b); 147 | protected slots: 148 | void openBuddyContents(); 149 | private: 150 | QLineEdit* m_buddy; 151 | QString m_baseDir; 152 | QString m_dlgTitle; 153 | QString m_dlgFilter; 154 | }; 155 | 156 | 157 | /** \brief specialized QToolButton which allows to open the file referenced by the buddy edit 158 | * \ingroup JKQtExtrasWidgetsButtons 159 | * 160 | * \image html JKQTEFileExecuteToolButton.png 161 | * 162 | * Usage example: 163 | * 164 | * \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTEFileExecuteToolButton 165 | */ 166 | class JKQTEXTRAS_LIB_EXPORT JKQTEFileExecuteToolButton : public QToolButton { 167 | Q_OBJECT 168 | public: 169 | /** Default constructor */ 170 | JKQTEFileExecuteToolButton(QWidget* parent=nullptr); 171 | /** Default destructor */ 172 | virtual ~JKQTEFileExecuteToolButton(); 173 | /** \brief buddy associated with this button */ 174 | const QLineEdit* buddy() const; 175 | /** \brief buddy associated with this button */ 176 | QLineEdit* buddy(); 177 | /** \brief returns a basedir in which files are searched for execution, if this is empty the current directory is used */ 178 | QString getBaseDir() const; 179 | public slots: 180 | /** \brief set the buddy widget, which provides the contents */ 181 | void setBuddy(QLineEdit* b); 182 | /** \brief set a basedir in which files are searched for execution, if this is empty the current directory is used */ 183 | void setBaseDir(const QString& b); 184 | protected slots: 185 | /** \brief executes the contents of the buddy() 186 | * 187 | * This internally calls \c QDesktopServices::openUrl(QUrl("file:///"+buddyContents,QUrl::TolerantMode)); 188 | * 189 | * \see setBaseDir() 190 | */ 191 | void openBuddyContents(); 192 | 193 | private: 194 | QLineEdit* m_buddy; 195 | QString m_baseDir; 196 | }; 197 | 198 | #endif // JKQTESPECIALTOOLBUTTON_H 199 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqteprogresslistwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JKQTEPROGRESSLISTWIDGET_H 19 | #define JKQTEPROGRESSLISTWIDGET_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include "jkqtextras_imexport.h" 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | /*! \brief displays a list of items with an icon next to each which indicates the current task performed on the item (e.g. not started, in progress, success, failed, ...) 35 | \ingroup JKQtExtrasWidgetsProgress 36 | 37 | \image html JKQTEProgressListWidget.png 38 | 39 | Usage example: 40 | 41 | \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTEProgressListWidget 42 | 43 | There are two types of APIs that allow to modify the items: 44 | - You can use setItemStatus() to explicitly set a status for an item 45 | - you can use start() to set the first item in state JKQTEProgressListWidget::statusNotStarted 46 | to go to JKQTEProgressListWidget::statusInProgress. Then you can call nextItem(newState) 47 | to set the status of the item currently in JKQTEProgressListWidget::statusInProgress to the 48 | give \c newState and set the next item to JKQTEProgressListWidget::statusInProgress . 49 | . 50 | */ 51 | class JKQTEXTRAS_LIB_EXPORT JKQTEProgressListWidget : public QWidget { 52 | Q_OBJECT 53 | public: 54 | enum { 55 | statusNone=0, 56 | statusNotStarted=1, 57 | statusDone=2, 58 | statusFailed=3, 59 | statusInProgress=4, 60 | statusUser=5 61 | }; 62 | 63 | explicit JKQTEProgressListWidget(QWidget *parent = nullptr); 64 | 65 | /** \brief define an icon to be used for a given status. 66 | * 67 | * \note The widget pre-defines default icons for the states JKQTEProgressListWidget::statusNone, JKQTEProgressListWidget::statusNotStarted, JKQTEProgressListWidget::statusDone, JKQTEProgressListWidget::statusFailed, JKQTEProgressListWidget::statusInProgress. */ 68 | void defineIcon(int status, QIcon icon); 69 | /** \brief returns the icon used for a given \a status */ 70 | QIcon getIcon(int status) const; 71 | 72 | /** \brief returns the status of a given \a item */ 73 | int getStatus(int item) const; 74 | /** \brief returns the text of a given \a item */ 75 | QString getText(int item) const; 76 | /** \brief deletes a given \a item */ 77 | void deleteItem(int item); 78 | /** \brief returns the number of items in the list */ 79 | int count() const; 80 | /** \brief add an item to the list */ 81 | void addItem(const QString& text, int status=statusNotStarted); 82 | /** \brief returns currently used icon size for status icons */ 83 | QSize getIconSize() const; 84 | /** \brief inidctaes whether to center the display */ 85 | bool isCentered() const; 86 | 87 | public slots: 88 | /** \brief searches for the first item with status statusInProgress and switches it's status to \a newStatusLast The next item with status statusNotStarted is switched to statusInProgress */ 89 | void nextItem(int newStatusLast=statusDone); 90 | /** \brief searched for the first item with status statusNotStarted and sets it to statusInProgress */ 91 | void start(); 92 | /** \brief reset the list, i.e. set all items to JKQTEProgressListWidget::statusNotStarted */ 93 | void reset(); 94 | 95 | /** \brief set the status of the \a item -th item (allowed values: JKQTEProgressListWidget::statusNone, JKQTEProgressListWidget::statusNotStarted, JKQTEProgressListWidget::statusDone, JKQTEProgressListWidget::statusFailed, JKQTEProgressListWidget::statusInProgress, JKQTEProgressListWidget::statusUser ...) */ 96 | void setItemStatus(int item, int status); 97 | /** \brief set the text of the \a item -th item */ 98 | void setItemText(int item, const QString& text); 99 | 100 | /** \brief inidctaes whether to center the display */ 101 | void setCentered(bool centered); 102 | /** \brief sets the currently used icon size for status icons */ 103 | void setIconSize(QSize size); 104 | /** \brief sets the currently used icon size for status icons */ 105 | void setIconSize(int size); 106 | 107 | protected: 108 | struct widgetstruct { 109 | QLabel* labIcon; 110 | QLabel* labText; 111 | }; 112 | 113 | bool m_centered; 114 | 115 | QStringList m_items; 116 | QList m_status; 117 | QMap m_icons; 118 | QList m_widgets; 119 | QSize m_iconSize; 120 | QGridLayout* layout; 121 | 122 | void updateWidgets(); 123 | }; 124 | 125 | 126 | /** \brief a dialog with a JKQTEProgressListWidget and a cancel button (optional) 127 | * \ingroup JKQtExtrasWidgetsProgress 128 | * 129 | * \image html JKQTEProgressListDialog.png 130 | * 131 | * Usage example: 132 | * 133 | * \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTEProgressListDialog 134 | * 135 | * \see JKQTEProgressListWidget 136 | */ 137 | class JKQTEXTRAS_LIB_EXPORT JKQTEProgressListDialog : public QDialog { 138 | Q_OBJECT 139 | public: 140 | JKQTEProgressListDialog(QWidget * parent = nullptr, Qt::WindowFlags f = nullptr); 141 | JKQTEProgressListDialog(const QString & labelText, const QString & cancelButtonText, int minimum, int maximum, QWidget * parent = 0, Qt::WindowFlags f = 0); 142 | JKQTEProgressListWidget* getProgressList() const; 143 | 144 | /** \brief switch visibility of cancel button (\a hasCancel \c =true ) and whether pressing it causes the dialog to be rejected. */ 145 | void setHasCancelButton(bool hasCancel, bool cancelRejects=false); 146 | /** \brief switch additional progress indicator on or off */ 147 | void setHasProgressBar(bool hasProg=true); 148 | /** \brief indicates whether the dialog was canceled (via the cancel button or calling cancel() ) */ 149 | bool wasCanceled() const; 150 | /** \copydoc JKQTEProgressListWidget::defineIcon() */ 151 | void defineIcon(int status, QIcon icon); 152 | /** \copydoc JKQTEProgressListWidget::addItem() */ 153 | void addItem(const QString& text, int status=JKQTEProgressListWidget::statusNotStarted); 154 | /** \copydoc JKQTEProgressListWidget::count() */ 155 | int count() const; 156 | public slots: 157 | /** \brief cancel the dialog */ 158 | void cancel(); 159 | /** \brief searches for the first item with status statusInProgress and switches it's status to \a newStatusLast The next item with status statusNotStarted is switched to statusInProgress */ 160 | void nextItem(int newStatusLast=JKQTEProgressListWidget::statusDone); 161 | /** \copydoc JKQTEProgressListWidget::start() */ 162 | void start(); 163 | /** \copydoc JKQTEProgressListWidget::reset() */ 164 | void reset(); 165 | 166 | /** \copydoc JKQTEProgressListWidget::setItemStatus() */ 167 | void setItemStatus(int item, int status); 168 | /** \copydoc JKQTEProgressListWidget::setItemText() */ 169 | void setItemText(int item, const QString& text); 170 | /** \brief set the range of the progress indicator */ 171 | void setRange(int min, int max); 172 | /** \brief set the range minimum of the progress indicator */ 173 | void setMinimum(int min); 174 | /** \brief set the range maximum of the progress indicator */ 175 | void setMaximum(int max); 176 | /** \brief set the value of the progress indicator */ 177 | void setValue(int value); 178 | /** \brief set the text on the progress indicator*/ 179 | void setProgressText(const QString& text); 180 | /** \brief set the text on the label */ 181 | void setLabelText(const QString& text); 182 | /** \brief set the text on the cancel button */ 183 | void setCancelButtonText(const QString& text); 184 | signals: 185 | /** \brief emitted when the dialog is canceled */ 186 | void canceled(); 187 | protected: 188 | JKQTEProgressListWidget* list; 189 | QPushButton* btnCancel; 190 | bool m_wasCanceled; 191 | bool m_cancelRejects; 192 | bool m_hasProgressBar; 193 | QLabel* labProgress; 194 | QProgressBar* progress; 195 | QFrame* progressLine; 196 | 197 | virtual void showEvent(QShowEvent* event); 198 | void createWidgets(); 199 | }; 200 | 201 | 202 | #endif // JKQTEPROGRESSLISTWIDGET_H 203 | 204 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtecolorslider.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2019 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JKQTECOLORSLIDER_H 19 | #define JKQTECOLORSLIDER_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "jkqtextras_imexport.h" 26 | 27 | /*! \brief a QSlider that allows to choose a color hue 28 | \ingroup JKQtExtrasWidgetsSliders 29 | 30 | 31 | Horizontal Hue-Slider: 32 | \image html JKQTEColorSliderHorizontal.png 33 | 34 | Vertical Hue Slider: 35 | \image html JKQTEColorSliderVertical.png 36 | 37 | Basic usage is simple: 38 | 39 | \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTEColorSlider 40 | 41 | \section JKQTEColorSliderBaseColorMode Base Color Mode 42 | 43 | Especially when building a color-chooser, you need to combine several sliders. 44 | That then define a color together. To support such modes, the slider can use 45 | a "base color" i.e. an input color which is then modified and output again. 46 | The following functions support this mode: 47 | - setBaseColor() 48 | - baseColor() 49 | - modifiedColor() 50 | - Signal: colorChanged() 51 | . 52 | 53 | Here is an example of how to use this feature: 54 | 55 | \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTEColorSliderRGBGroup 56 | 57 | \image html JKQTEColorSliderRGBGroup.png 58 | 59 | */ 60 | class JKQTEXTRAS_LIB_EXPORT JKQTEColorSlider : public QSlider { 61 | Q_OBJECT 62 | Q_PROPERTY(QColor baseColor READ baseColor WRITE setBaseColor USER true) 63 | Q_PROPERTY(SliderMode sliderMode READ sliderMode WRITE setSliderMode USER true) 64 | Q_PROPERTY(QBrush indicatorBrush READ indicatorBrush WRITE setIndicatorBrush USER true) 65 | Q_PROPERTY(QPen indicatorPen READ indicatorPen WRITE setIndicatorPen USER true) 66 | Q_PROPERTY(IndicatorStyle IndicatorStyle READ indicatorStyle WRITE setIndicatorStyle USER true) 67 | public: 68 | /** \brief available modes for the slider 69 | * 70 | * the appearance and the range of the slider depend on this */ 71 | enum SliderMode { 72 | GreySlider=0, /**< the slider modifies the grey color channel \image html JKQTEColorSlider_Grey.png */ 73 | GraySlider=GreySlider, /**< the slider modifies the grey color channel \image html JKQTEColorSlider_Grey.png */ 74 | RedSlider, /**< the slider modifies the red color channel \image html JKQTEColorSlider_Red.png */ 75 | GreenSlider, /**< the slider modifies the green color channel \image html JKQTEColorSlider_Green.png */ 76 | BlueSlider, /**< the slider modifies the blue color channel \image html JKQTEColorSlider_Blue.png */ 77 | HueSlider, /**< the slider modifies the hue color channel (from HSV color model) \image html JKQTEColorSlider_Hue.png */ 78 | SaturationSlider, /**< the slider modifies the saturation color channel (from HSV color model) \image html JKQTEColorSlider_Saturation.png */ 79 | ValueSlider, /**< the slider modifies the value color channel (from HSV color model) \image html JKQTEColorSlider_Value.png */ 80 | TransparencySlider, /**< the slider modifies the transparency color channel \image html JKQTEColorSlider_Transparency.png */ 81 | AlphaSlider=TransparencySlider, /**< the slider modifies the transparency color channel \image html JKQTEColorSlider_Transparency.png */ 82 | }; 83 | Q_ENUM(SliderMode) 84 | 85 | /** \brief available modes for the slider 86 | * 87 | * the appearance and the range of the slider depend on this */ 88 | enum IndicatorStyle { 89 | FixedColorDoubleArrowIndicator=0, /**< draws two inward pointing triangles as indicator, filled with indicatorBrush() \image html JKQTEColorSlider_FixedColorDoubleArrowIndicator.png */ 90 | FixedColorCircleIndicator, /**< draws a circle as indicator, filled with indicatorBrush() \image html JKQTEColorSlider_FixedColorCircleIndicator.png */ 91 | SelectedColorDoubleArrowIndicator, /**< draws two inward pointing triangles as indicator, filled with the current color \image html JKQTEColorSlider_SelectedColorDoubleArrowIndicator.png */ 92 | SelectedColorCircleIndicator, /**< draws a circle as indicator, filled with the current color \image html JKQTEColorSlider_SelectedColorCircleIndicator.png */ 93 | }; 94 | Q_ENUM(IndicatorStyle) 95 | 96 | explicit JKQTEColorSlider(QWidget *parent = nullptr); 97 | explicit JKQTEColorSlider(Qt::Orientation orientation, QWidget *parent = nullptr); 98 | explicit JKQTEColorSlider(SliderMode mode, QWidget *parent = nullptr); 99 | explicit JKQTEColorSlider(SliderMode mode, Qt::Orientation orientation, QWidget *parent = nullptr); 100 | 101 | /** \brief returns the currently set color/slider mode 102 | * 103 | * The appearance and the range of the slider depend on this 104 | * 105 | * \see SliderMode setSliderMode() */ 106 | SliderMode sliderMode() const; 107 | /** \brief style of the indicator */ 108 | IndicatorStyle indicatorStyle() const; 109 | /** \brief takes the color \a colorIn and applies the value of the slider to the color */ 110 | QColor modifiedColor(QColor colorIn) const; 111 | /** \brief takes the color baseColor() and applies the value of the slider to the color 112 | * 113 | * \see \ref JKQTEColorSliderBaseColorMode baseColor(), setBaseColor(), baseColor(), colorChanged() 114 | * */ 115 | QColor modifiedColor() const; 116 | /** \brief returns the currently set base color that is modified by the slider 117 | * 118 | * \see \ref JKQTEColorSliderBaseColorMode baseColor(), setBaseColor(), modifiedColor(), colorChanged() 119 | * */ 120 | QColor baseColor() const; 121 | 122 | /** \brief returns the QBrush used to draw the indicator */ 123 | const QBrush &indicatorBrush() const; 124 | /** \brief returns the QPen used to draw the indicator */ 125 | const QPen& indicatorPen() const; 126 | /** \brief returns the QBrush used to draw the indicator */ 127 | QBrush& indicatorBrush(); 128 | /** \brief returns the QPen used to draw the indicator */ 129 | QPen& indicatorPen(); 130 | 131 | /** \brief sets the QBrush used to draw the indicator */ 132 | void setIndicatorBrush(const QBrush& b); 133 | /** \brief sets the QPen used to draw the indicator */ 134 | void setIndicatorPen(const QPen &p); 135 | /** \brief sets the style of the indicator */ 136 | void setIndicatorStyle(IndicatorStyle s) ; 137 | 138 | virtual QSize minimumSizeHint() const override; 139 | virtual QSize sizeHint() const override; 140 | 141 | signals: 142 | /** \brief emitted when the slider moves, the color is based on the baseColor(), 143 | * modified by the slider value 144 | * 145 | * \see \ref JKQTEColorSliderBaseColorMode baseColor(), setBaseColor(), modifiedColor(), colorChanged() 146 | * */ 147 | void colorChanged(QColor color); 148 | public slots: 149 | /** \brief sets the currently set color/slider mode 150 | * 151 | * The appearance and the range of the slider depend on this 152 | * 153 | * \note This also changes the range of the slider! 154 | * \see SliderMode sliderMode() 155 | */ 156 | void setSliderMode(SliderMode mode); 157 | /** \brief sets the currently set base color that is modified by the slider 158 | * 159 | * \see \ref JKQTEColorSliderBaseColorMode baseColor(), baseColor(), modifiedColor(), colorChanged() 160 | * */ 161 | void setBaseColor(QColor baseColor); 162 | protected slots: 163 | void baseSliderChanged(int value); 164 | protected: 165 | /** \brief currently set color/slider mode */ 166 | SliderMode m_mode; 167 | /** \brief currently set base color that is modified by the slider 168 | * 169 | * \see \ref JKQTEColorSliderBaseColorMode baseColor(), baseColor(), modifiedColor(), colorChanged() */ 170 | QColor m_baseColor; 171 | /** \brief QBrush used to draw the indicator */ 172 | QBrush m_indicatorBrush; 173 | /** \brief QPen used to draw the indicator */ 174 | QPen m_indicatorPen; 175 | /** \brief style of the indicator */ 176 | IndicatorStyle m_indicatorStyle; 177 | /** \brief returns the default base color for a given slider mode */ 178 | static QColor defaultBaseColor(SliderMode mode); 179 | /** \brief paints the slider */ 180 | virtual void paintEvent(QPaintEvent *ev) override; 181 | 182 | 183 | }; 184 | 185 | 186 | #endif // JKQTECOLORSLIDER_H 187 | -------------------------------------------------------------------------------- /lib/jkqtextras/jkqtedoubleedit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JKTEDOUBLEEDIT_H 19 | #define JKTEDOUBLEEDIT_H 20 | 21 | #include "jkqtextras_imexport.h" 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | /*! \brief this QLineEdit descendent implements a validating edit field that allows to enter floating point numbers 32 | with a possibly defined range 33 | \ingroup JKQtExtrasWidgetsEdits 34 | 35 | This widget supports this set of features: 36 | - This widget accepts input in standard and scientific notation. 37 | - The widget can optionally check (and correct) the edit range. Checking can be switched for 38 | the upper and lower bound indepently! 39 | - The maximal number of decimals may be set using setDecimals(). \note Note that trailing 0s are deleted from the string. 40 | - This widget accepts comma and point as decimal separator and transforms them to the systems decimal separator, 41 | set in the current locale. 42 | - This widget colors the background of the widget if the number you entered exceeds the range. 43 | In that case the edit corrects the value when it looses its focus. The error background color may be set 44 | by setErrorBackgroundColor(). 45 | - It is also possible to extend the default context menu with new QAction's by calling addContextmenuAction(), 46 | deleteContextmenuAction() and clearContextmenuActions(). 47 | - This widget may also be used to catch key events. You will have to register each event using addKeyEvent(). 48 | If a key event matches, the keyEvent() signal will be emitted. 49 | . 50 | 51 | Screenshot: 52 | \image html JKQTEDoubleEdit.png 53 | 54 | Basic usage is simple: 55 | \snippet jkqtextras_test/testmainwindow.cpp Example: JKQTEDoubleEdit 56 | 57 | */ 58 | class JKQTEXTRAS_LIB_EXPORT JKQTEDoubleEdit : public QLineEdit { 59 | Q_OBJECT 60 | Q_PROPERTY(int decimals READ decimals WRITE setDecimals USER true ) 61 | Q_PROPERTY(double value READ value WRITE setValue USER true ) 62 | Q_PROPERTY(double increment READ increment WRITE setIncrement USER true ) 63 | Q_PROPERTY(double maximum READ maximum WRITE setMaximum USER true ) 64 | Q_PROPERTY(double minimum READ minimum WRITE setMinimum USER true ) 65 | Q_PROPERTY(bool checkMaximum READ checkMaximum WRITE setCheckMaximum USER true ) 66 | Q_PROPERTY(bool checkMinimum READ checkMinimum WRITE setCheckMinimum USER true ) 67 | Q_PROPERTY(bool showUpDown READ showUpDown WRITE setShowUpDown USER true ) 68 | Q_PROPERTY(bool integerWidget READ isIntegerWidget WRITE setIntegerWidget USER true ) 69 | Q_PROPERTY(QColor errorBackgroundColor READ errorBackgroundColor WRITE setErrorBackgroundColor USER true ) 70 | Q_PROPERTY(QColor noIntegerBackgroundColor READ noIntegerBackgroundColor WRITE setNoIntegerBackgroundColor USER true ) 71 | Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor USER true ) 72 | public: 73 | /** \brief class constructor */ 74 | JKQTEDoubleEdit(QWidget* parent); 75 | /** \brief class destructor */ 76 | virtual ~JKQTEDoubleEdit(); 77 | /** \brief return the value entered in this widget */ 78 | double value() const; 79 | /** \brief add a new QAction to the default context menu (append after a seprator) */ 80 | void addContextmenuAction(QAction* menuAction); 81 | /** \brief remove a given QAction from the default context menu (added with addContextmenuAction() ) */ 82 | void deleteContextmenuAction(QAction* menuAction); 83 | /** \brief remove all additional context menu QAction s */ 84 | void clearContextmenuActions(); 85 | /** \brief add a new Key Event */ 86 | void addKeyEvent(int key, Qt::KeyboardModifiers modifiers); 87 | /** \brief maximum of the value range */ 88 | double maximum() const; 89 | /** \brief minimum of the value range */ 90 | double minimum() const; 91 | /** \brief returns whether the range maximum is checked */ 92 | bool checkMaximum() const; 93 | /** \brief returns whether the range minimum is checked */ 94 | bool checkMinimum() const; 95 | /** \brief returns the number of displayed decimals */ 96 | int decimals() const; 97 | /** \brief background color used when an entry error occured (unparseable string) */ 98 | QColor errorBackgroundColor() const; 99 | /** \brief color for the widget's background */ 100 | QColor backgroundColor() const; 101 | /** \brief background color used when an setIntegerWidget(true), but the entered number is no integer */ 102 | QColor noIntegerBackgroundColor() const; 103 | /** \brief increment, when using the buttons or up/down keys */ 104 | double increment() const; 105 | /** \brief are the up/down buttons shown? */ 106 | bool showUpDown() const; 107 | /** \brief is integer edit mode en-/disable (only integer numbers are allowed, i.e. no decimals!) */ 108 | bool isIntegerWidget() const; 109 | 110 | public slots: 111 | /** \brief background color used when an setIntegerWidget(true), but the entered number is no integer */ 112 | void setNoIntegerBackgroundColor(const QColor &noIntegerBackgroundColor); 113 | /** \brief background color used when an entry error occured (unparseable string) */ 114 | void setErrorBackgroundColor(const QColor& color); 115 | /** \brief color for the widget's background */ 116 | void setBackgroundColor(const QColor& color); 117 | /** \brief sets whether the range maximum is checked */ 118 | void setCheckMaximum(bool check); 119 | /** \brief sets whether the range minimum is checked */ 120 | void setCheckMinimum(bool check); 121 | /** \brief sets which bounds of the range to checked */ 122 | void setCheckBounds(bool min, bool max); 123 | /** \brief en-/disable integer edit mode (only integer numbers are allowed, i.e. no decimals!) */ 124 | void setIntegerWidget(bool intWidget); 125 | /** \brief set the value entered in this widget */ 126 | void setValue(double value); 127 | /** \brief maximum of the value range, also calls setCheckMaximum(true) */ 128 | void setMaximum(double value); 129 | /** \brief minimum of the value range, also calls setCheckMinimum(true) */ 130 | void setMinimum(double value); 131 | /** \brief set the value range, also calls setCheckMaximum(true) and setCheckMinimum(true) */ 132 | void setRange(double min, double max); 133 | /** \brief set the number of displayed decimals */ 134 | void setDecimals(int decimals); 135 | /** \brief increase value by increment() */ 136 | void stepUp(); 137 | /** \brief decrease value by increment() */ 138 | void stepDown(); 139 | /** \brief increment, when using the buttons or up/down keys */ 140 | void setIncrement(double inc); 141 | /** \brief sets the single step increment (equivalent to setIncrement(inc) ) */ 142 | void setSingleStep(double inc); 143 | /** \brief sets whether up/down buttons are shown */ 144 | void setShowUpDown(bool showUpDown); 145 | signals: 146 | /** \brief emited whenever a entered value changed */ 147 | void valueChanged(double value); 148 | /** \brief emitted when the widget looses focus */ 149 | void focusOut(double value); 150 | /** \brief emitted when a key event matches */ 151 | void keyEventMatches(int key, Qt::KeyboardModifiers modifiers); 152 | protected: 153 | /** \brief used to store the key events */ 154 | QList > m_keyEvents; 155 | /** \brief list of additional actions for context menu */ 156 | QList m_contextmenuActions; 157 | /** \brief regular expression used to match floating point numbers */ 158 | QRegExp m_regexp; 159 | /** \brief RegExp validator for this widget */ 160 | QRegExpValidator* m_validator; 161 | /** \brief hidden setValidator() method */ 162 | void setValidator(const QValidator* validator); 163 | /** \brief error color */ 164 | QColor m_errorColor; 165 | QColor m_background; 166 | QColor m_noIntegerBackgroundColor; 167 | double m_maximum; 168 | double m_minimum; 169 | double m_increment; 170 | bool m_checkMaximum; 171 | bool m_checkMinimum; 172 | int m_decimals; 173 | QString JKDoubleEdit_BASIC_REGEXP; 174 | bool m_Integer; 175 | bool m_showUpDown; 176 | QToolButton* m_btnUp; 177 | QToolButton* m_btnDown; 178 | double m_current; 179 | virtual void contextMenuEvent(QContextMenuEvent* event); 180 | protected slots: 181 | void updateWidget(const QString & text); 182 | virtual void focusOutEvent ( QFocusEvent * event ) ; 183 | virtual void keyPressEvent ( QKeyEvent * event ) ; 184 | virtual void resizeEvent ( QResizeEvent * event ) ; 185 | virtual void wheelEvent(QWheelEvent *event); 186 | }; 187 | 188 | #endif // JKTEDOUBLEEDIT_H 189 | -------------------------------------------------------------------------------- /doc/dox/buildinstructions.dox: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | \page page_buildinstructions Build Instructions 4 | 5 | This page explains how to build JKQtExtras and to use the results in your own Projects. 6 | 7 | \tableofcontents 8 | 9 | \section page_buildinstructions_CMAKE Build using CMake 10 | 11 | \subsection page_buildinstructions_CMAKE_RUN Running a Build with CMake 12 | 13 | The preferred way to build JKQtExtras is using CMake. You can find a detailed explanation of CMake at https://cliutils.gitlab.io/modern-cmake/. The CMake-build is defined in `CMakeLists.txt` files, found in many of the directories of the code repository. Especially in the root directory and the two subdirectories \c ./lib/ and \c ./examples/ . 14 | 15 | You can build JKQtExtras (and also the examples) by either opening the file CMakeLists.txt in QTCreator (which has CMake integration), or by calling \c CMake by hand. How to do this depends on your local system und build environment. 16 | 17 | 18 | \subsubsection page_buildinstructions_CMAKE_MAKEFILE Building with MinGW/GNU/... Makefiles 19 | 20 | You can use (MinGW) Makefiles by calling: 21 | 22 | \code{.sh} 23 | $ mkdir build 24 | $ cd build 25 | $ cmake .. -G "MinGW Makefiles" "-DCMAKE_PREFIX_PATH=" 26 | $ cmake --build . --config "Debug" 27 | $ cmake --build . --config "Debug" --target install 28 | \endcode 29 | 30 | \subsubsection page_buildinstructions_CMAKE_VSTUDIO Building with Visual Studio 31 | 32 | For Visual Studio it could look like this: 33 | \code{.sh} 34 | $ mkdir build 35 | $ cd build 36 | $ cmake .. -G "Visual Studio 15 2017 Win64" "-DCMAKE_PREFIX_PATH=" 37 | \endcode 38 | Where \c could be e.g. \c C:/development/Qt5/5.12.0/msvc2017_64 . This call results in a Visual Studio solution \c build/JKQtExtras.sln that you can load and compile from the Visual Studio IDE. Alternatively you can also build the solution directly calling: 39 | \code{.sh} 40 | $ cmake --build . --config "Debug" 41 | \endcode 42 | Afterwards you can install the library by 43 | \code{.sh} 44 | $ cmake --build . --config "Debug" --target install 45 | \endcode 46 | 47 | \subsection page_buildinstructions_CMAKE_CONFIG Configuring a Build with CMake 48 | 49 | The CMake build system offers several configuration variables that you may set/change to modify the outcome of the build: 50 | - \c CMAKE_PREFIX_PATH : add the path to your Qt installatrion to this variable, so the \c find_package(Qt5...) commands find the libraries you want to use 51 | - \c JKQtExtras_BUILD_SHARED_LIBS : Build as shared library (default: \c ON ) 52 | - \c JKQtExtras_BUILD_STATIC_LIBS : Build as static library (default: \c ON ) 53 | - \c JKQtExtras_BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE : If set, the build-type is appended to the library name (default: \c ON ) 54 | - \c JKQtExtras_BUILD_EXAMPLES : Build examples (default: \c ON ) 55 | - \c CMAKE_INSTALL_PREFIX : Install directory for the library 56 | . 57 | 58 | 59 | 60 | 61 | \subsection page_buildinstructions_CMAKE_USAGE Using a built, generated with CMake 62 | 63 | After building and installing JKQtExtras you have all files that you need inside the instal directory: 64 | - \c /include contains all required header files 65 | - \c /bin contains the shared libraries 66 | - \c /lib contains the link libraries 67 | - \c /lib/cmake contains files necessary for CMake's \c find_package() to work 68 | . 69 | 70 | You can find an example project that uses a complete cmake-build here: \ref JKQTCMakeLinkExample (online: https://github.com/jkriege2/JKQtExtras/blob/master/examples/cmake_link_example). 71 | 72 | Here is the \c CMakeLists.txt from that directory: 73 | 74 | \code 75 | # set minimum required CMake-Version 76 | cmake_minimum_required(VERSION 3.10) 77 | 78 | # set Project name 79 | set(EXAMPLE_NAME simpletest) 80 | set(EXENAME jkqtetest_${EXAMPLE_NAME}) 81 | project(${EXAMPLE_NAME} LANGUAGES CXX) 82 | 83 | # some basic configurations 84 | set(CMAKE_AUTOMOC ON) 85 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 86 | set(CMAKE_CXX_STANDARD 11) 87 | #set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) 88 | 89 | # Configure project for usage of Qt5 90 | find_package(Qt5 COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGl REQUIRED) 91 | 92 | # include JKQtExtras 93 | find_package(JKQtExtrasLib REQUIRED) 94 | 95 | # For Visual Studio, we need to set some additional compiler options 96 | if(MSVC) 97 | add_compile_options(/EHsc) 98 | # To enable M_PI, M_E,... 99 | add_definitions(/D_USE_MATH_DEFINES) 100 | # To Prevent Errors with min() and max() 101 | add_definitions(/DNOMINMAX) 102 | # To fix error: C2338: va_start argument must not 103 | # have reference type and must not be parenthesized 104 | add_definitions(/D_CRT_NO_VA_START_VALIDATION) 105 | endif() 106 | 107 | # add the example executable 108 | add_executable(${EXENAME} WIN32 simpletest.cpp) 109 | # ... link against Qt5 and JKQtExtrasLib 110 | # (you could use JKQtExtrasSharedLib if you don't want to link againast the 111 | # static version, but against the shared/DLL version). 112 | target_link_libraries(${EXENAME} Qt5::Core Qt5::Widgets Qt5::Gui Qt5::PrintSupport Qt5::Svg Qt5::Xml JKQtExtrasLib) 113 | 114 | # Installation 115 | install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 116 | \endcode 117 | 118 | 119 | 120 | To build this example, you first need to make a subdirectory `build` and then call CMake form that subdirectory: 121 | \code.sh 122 | $ mkdir build 123 | $ cd build 124 | $ cmake .. -G "" "-DCMAKE_PREFIX_PATH= -DCMAKE_MODULE_PATH=" 125 | \endcode 126 | The you can use the generated makefiles (e.g. load them in an editor, or build them jsing \c make ). In the last line above, you need to specify two directories: 127 | - \c points to you Qt installation 128 | - \c points to the directory containing the \c XYZ.cmake -files from the JKQtExtras build. Typically this is \c /lib/cmake , where \c is the directory into which you installed JKQtExtras. 129 | . 130 | 131 | \section page_buildinstructions_QMAKE Build using QMake 132 | 133 | \subsection page_buildinstructions_QMAKEINCLUDE QMake Include Project 134 | 135 | If you want to simply include the JKQtExtras Source code into your projects, without build a shared or static library and linking against it, you can use one of these QMake-Include files: 136 | - lib/JKQtExtras.pri includes the complete library (JKQtExtras, JKQTFastPlotter, JKQTMathText) 137 | . 138 | 139 | In your QMake-projects it is then sufficient to add a line like: 140 | \code{.qmake} 141 | include(/lib/JKQtExtras.pri) 142 | \endcode 143 | 144 | \subsection page_buildinstructions_QMAKESTATIC QMake Static Library 145 | 146 | There is a single `.PRO`-file, that can be used to build the full library: 147 | - qmake/staticlib/JKQtExtraslib/JKQtExtraslib.pro builds the complete library (JKQtExtras, JKQTFastPlotter, JKQTMathText) as static link library 148 | . 149 | This will produce a static link library that you can include into your projects, e.g. with the following QMake-snippet: 150 | 151 | \code{.qmake} 152 | # include JKQtExtras library 153 | DEPENDPATH += \ 154 | /lib \ 155 | /qmake/staticlib/JKQtExtraslib 156 | INCLUDEPATH += /lib 157 | CONFIG (debug, debug|release) { 158 | DEPENDPATH += /qmake/staticlib/JKQtExtraslib/debug 159 | LIBS += -L/qmake/staticlib/JKQtExtraslib/debug -lJKQtExtraslib_debug 160 | } else { 161 | DEPENDPATH += /qmake/staticlib/JKQtExtraslib/release 162 | LIBS += -L/qmake/staticlib/JKQtExtraslib/release -lJKQtExtraslib 163 | } 164 | \endcode 165 | 166 | This snippet assumes that you built the libraries with the provided `.PRO`-files. You can also add a second `.pro`-file to your projects, which integrates both as subdirs. Such files are used for all examples in this project. Here is an example: 167 | \code{.qmake} 168 | TEMPLATE = subdirs 169 | 170 | # the (static library version) of JKQtExtras 171 | JKQtExtraslib_static.file = ../../qmake/staticlib/JKQtExtraslib/JKQtExtraslib.pro 172 | 173 | # your project file, with declared dependencies on JKQtExtraslib_static 174 | test_styling.file=$$PWD/test_styling.pro 175 | test_styling.depends = JKQtExtraslib_static 176 | 177 | # add the two entries to SUBDIRS 178 | SUBDIRS += JKQtExtraslib_static test_styling 179 | \endcode 180 | 181 | 182 | 183 | \subsection page_buildinstructions_QMAKEDYNAMIC QMake Dynamic Library 184 | 185 | There is a single `.PRO`-files, that can be used to build the full library: 186 | - qmake/sharedlib/JKQtExtraslib/JKQtExtraslib.pro builds the complete library (JKQtExtras, JKQTFastPlotter, JKQTMathText) as shared library 187 | . 188 | This will produce a dynamic link library that you can include into your projects, e.g. with the following QMake-snippet: 189 | 190 | \code{.qmake} 191 | # include JKQtExtras library 192 | DEPENDPATH += \ 193 | /lib \ 194 | /qmake/sharedlib/JKQtExtraslib 195 | INCLUDEPATH += /lib 196 | DEFINES += JKQTCOMMON_LIB_IN_DLL JKQTFASTPLOTTER_LIB_IN_DLL JKQTMATHTEXT_LIB_IN_DLL JKQtExtras_LIB_IN_DLL 197 | CONFIG (debug, debug|release) { 198 | # ensure that DLLs are copied to the output directory 199 | install_JKQtExtras_dll.files = /qmake/sharedlib/JKQtExtraslib/debug/JKQtExtraslib_debug.* 200 | install_JKQtExtras_dll.path = $$OUT_PWD 201 | INSTALLS += install_JKQtExtras_dll 202 | # link agains DLLs 203 | DEPENDPATH += /qmake/sharedlib/JKQtExtraslib/debug 204 | LIBS += -L/qmake/sharedlib/JKQtExtraslib/debug -lJKQtExtraslib_debug 205 | } else { 206 | # ensure that DLLs are copied to the output directory 207 | install_JKQtExtras_dll.files = /qmake/sharedlib/JKQtExtraslib/release/JKQtExtraslib.* 208 | install_JKQtExtras_dll.path = $$OUT_PWD 209 | INSTALLS += install_JKQtExtras_dll 210 | # link agains DLLs 211 | DEPENDPATH += /qmake/sharedlib/JKQtExtraslib/release 212 | LIBS += -L/qmake/sharedlib/JKQtExtraslib/release -lJKQtExtraslib 213 | } 214 | \endcode 215 | 216 | This snippet assumes that you built the libraries with the provided `.PRO`-files. You can also add a second `.pro`-file to your projects, which integrates both as subdirs. Such files are used for all examples in this project. Here is an example: 217 | \code{.qmake} 218 | TEMPLATE = subdirs 219 | 220 | # the (shared library version) of JKQtExtras 221 | JKQtExtraslib_shared.file = ../../qmake/sharedlib/JKQtExtraslib.pro 222 | 223 | # your project file, with declared dependencies on JKQtExtraslib_shared 224 | test_styling.file=$$PWD/test_styling.pro 225 | test_styling.depends = JKQtExtraslib_shared 226 | 227 | # add the two entries to SUBDIRS 228 | SUBDIRS += JKQtExtraslib_shared test_styling 229 | \endcode 230 | 231 | \note You will have to run a deployment step `make install` before running your executable, so the shared libararies are actually copied to the output directory (see `INSTALLS + ...` above). 232 | 233 | 234 | 235 | 236 | 237 | */ -------------------------------------------------------------------------------- /lib/jkqtextras/jkqteprogresslistwidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008-2020 Jan W. Krieger () 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include "jkqteprogresslistwidget.h" 19 | #include 20 | 21 | JKQTEProgressListWidget::JKQTEProgressListWidget(QWidget *parent) : 22 | QWidget(parent) 23 | { 24 | Q_INIT_RESOURCE(jkqteprogresslistwidget); 25 | m_icons[JKQTEProgressListWidget::statusNone]=QIcon(":/jkqteprogresslistwidget/statusNone.png"); 26 | m_icons[JKQTEProgressListWidget::statusDone]=QIcon(":/jkqteprogresslistwidget/statusDone.png"); 27 | m_icons[JKQTEProgressListWidget::statusFailed]=QIcon(":/jkqteprogresslistwidget/statusFailed.png"); 28 | m_icons[JKQTEProgressListWidget::statusNotStarted]=QIcon(":/jkqteprogresslistwidget/statusNotStarted.png"); 29 | m_icons[JKQTEProgressListWidget::statusInProgress]=QIcon(":/jkqteprogresslistwidget/statusInProgress.png"); 30 | m_iconSize=QSize(16,16); 31 | 32 | m_centered=true; 33 | layout=new QGridLayout(this); 34 | setLayout(layout); 35 | } 36 | 37 | void JKQTEProgressListWidget::defineIcon(int status, QIcon icon) { 38 | m_icons[status]=icon; 39 | } 40 | 41 | QIcon JKQTEProgressListWidget::getIcon(int status) const { 42 | return m_icons.value(status, QIcon()); 43 | } 44 | 45 | int JKQTEProgressListWidget::getStatus(int item) const { 46 | return m_status.value(item, JKQTEProgressListWidget::statusNone); 47 | } 48 | 49 | QString JKQTEProgressListWidget::getText(int item) const { 50 | return m_items.value(item, ""); 51 | } 52 | 53 | void JKQTEProgressListWidget::deleteItem(int item) { 54 | m_items.removeAt(item); 55 | m_status.removeAt(item); 56 | updateWidgets(); 57 | } 58 | 59 | int JKQTEProgressListWidget::count() const { 60 | return qMin(m_items.size(), m_status.size()); 61 | } 62 | 63 | void JKQTEProgressListWidget::addItem(const QString &text, int status) { 64 | m_items.append(text); 65 | m_status.append(status); 66 | updateWidgets(); 67 | } 68 | 69 | QSize JKQTEProgressListWidget::getIconSize() const { 70 | return m_iconSize; 71 | } 72 | 73 | void JKQTEProgressListWidget::setIconSize(QSize size) { 74 | m_iconSize=size; 75 | updateWidgets(); 76 | } 77 | 78 | void JKQTEProgressListWidget::setIconSize(int size) 79 | { 80 | setIconSize(QSize(size,size)); 81 | } 82 | 83 | bool JKQTEProgressListWidget::isCentered() const { 84 | return m_centered; 85 | } 86 | 87 | void JKQTEProgressListWidget::setCentered(bool centered) { 88 | m_centered=centered; 89 | updateWidgets(); 90 | } 91 | 92 | void JKQTEProgressListWidget::start() { 93 | for (int i=0; i=newCount; i--) { 124 | layout->removeWidget(m_widgets[i].labIcon); 125 | layout->removeWidget(m_widgets[i].labText); 126 | delete m_widgets[i].labIcon; 127 | delete m_widgets[i].labText; 128 | m_widgets.removeAt(i); 129 | } 130 | } else if (newCount>oldCount) { 131 | for (int i=oldCount; isetAlignment(Qt::AlignTop|Qt::AlignRight); 135 | w.labText=new QLabel(this); 136 | w.labText->setAlignment(Qt::AlignTop|Qt::AlignLeft); 137 | int row=layout->rowCount(); 138 | layout->addWidget(w.labIcon, row, 0); 139 | layout->addWidget(w.labText, row, 1); 140 | m_widgets.append(w); 141 | } 142 | } 143 | for (int i=0; isetPixmap(m_icons.value(m_status.value(i, JKQTEProgressListWidget::statusNone), QIcon()).pixmap(m_iconSize)); 145 | m_widgets[i].labText->setText(m_items.value(i, "")); 146 | } 147 | if (layout->columnCount()>1) { 148 | layout->setColumnStretch(0,0); 149 | layout->setColumnStretch(1,1); 150 | } 151 | } 152 | 153 | void JKQTEProgressListWidget::setItemStatus(int item, int status) 154 | { 155 | m_status[item]=status; 156 | updateWidgets(); 157 | } 158 | 159 | void JKQTEProgressListWidget::setItemText(int item, const QString& text) { 160 | m_items[item]=text; 161 | updateWidgets(); 162 | } 163 | 164 | JKQTEProgressListDialog::JKQTEProgressListDialog(QWidget *parent, Qt::WindowFlags f): 165 | QDialog(parent, f) 166 | { 167 | m_cancelRejects=false; 168 | m_wasCanceled=false; 169 | 170 | createWidgets(); 171 | } 172 | 173 | JKQTEProgressListDialog::JKQTEProgressListDialog(const QString &labelText, const QString &cancelButtonText, int minimum, int maximum, QWidget *parent, Qt::WindowFlags f): 174 | QDialog(parent, f) 175 | { 176 | m_cancelRejects=false; 177 | m_wasCanceled=false; 178 | m_hasProgressBar=true; 179 | 180 | createWidgets(); 181 | setHasProgressBar(true); 182 | setRange(minimum, maximum); 183 | btnCancel->setText(cancelButtonText); 184 | setProgressText(labelText); 185 | 186 | } 187 | 188 | void JKQTEProgressListDialog::cancel() { 189 | m_wasCanceled=true; 190 | emit canceled(); 191 | if (m_cancelRejects) reject(); 192 | } 193 | 194 | void JKQTEProgressListDialog::showEvent(QShowEvent *event) { 195 | m_wasCanceled=false; 196 | QDialog::showEvent(event); 197 | } 198 | 199 | void JKQTEProgressListDialog::createWidgets() { 200 | 201 | QGridLayout* layout=new QGridLayout(this); 202 | setLayout(layout); 203 | list=new JKQTEProgressListWidget(this); 204 | layout->addWidget(list, 0,0,1,2); 205 | progressLine=new QFrame(this); 206 | progressLine->setVisible(false); 207 | //progressLine->setFrameStyle(QFrame::HLine); 208 | layout->addWidget(progressLine, 1,0,1,2); 209 | progress=new QProgressBar(this); 210 | progress->setVisible(false); 211 | layout->addWidget(progress, 1,0,1,2); 212 | labProgress=new QLabel(this); 213 | labProgress->setAlignment(Qt::AlignHCenter|Qt::AlignTop); 214 | labProgress->setVisible(false); 215 | layout->addWidget(labProgress, 2,0,1,2); 216 | 217 | btnCancel=new QPushButton(tr("&Cancel"), this); 218 | layout->addWidget(btnCancel, 3,1); 219 | layout->addItem(new QSpacerItem(5,5,QSizePolicy::Expanding),1,0); 220 | 221 | connect(btnCancel, SIGNAL(pressed()), this, SLOT(cancel())); 222 | } 223 | 224 | void JKQTEProgressListDialog::defineIcon(int status, QIcon icon) 225 | { 226 | list->defineIcon(status, icon); 227 | } 228 | 229 | void JKQTEProgressListDialog::nextItem(int newStatusLast) 230 | { 231 | list->nextItem(newStatusLast); 232 | QApplication::processEvents(); 233 | QApplication::processEvents(); 234 | 235 | } 236 | 237 | void JKQTEProgressListDialog::start() 238 | { 239 | list->start(); 240 | QApplication::processEvents(); 241 | QApplication::processEvents(); 242 | 243 | } 244 | 245 | void JKQTEProgressListDialog::setItemStatus(int item, int status) 246 | { 247 | list->setItemStatus(item, status); 248 | repaint(); 249 | QApplication::processEvents(); 250 | QApplication::processEvents(); 251 | } 252 | 253 | void JKQTEProgressListDialog::setItemText(int item, const QString &text) 254 | { 255 | list->setItemText(item, text); 256 | repaint(); 257 | QApplication::processEvents(); 258 | QApplication::processEvents(); 259 | } 260 | 261 | void JKQTEProgressListDialog::setRange(int min, int max) 262 | { 263 | progress->setRange(min, max); 264 | repaint(); 265 | QApplication::processEvents(); 266 | QApplication::processEvents(); 267 | } 268 | 269 | void JKQTEProgressListDialog::setMinimum(int min) 270 | { 271 | progress->setMinimum(min); 272 | repaint(); 273 | QApplication::processEvents(); 274 | QApplication::processEvents(); 275 | } 276 | 277 | void JKQTEProgressListDialog::setMaximum(int max) 278 | { 279 | progress->setMaximum(max); 280 | repaint(); 281 | QApplication::processEvents(); 282 | QApplication::processEvents(); 283 | } 284 | 285 | void JKQTEProgressListDialog::setValue(int value) 286 | { 287 | progress->setValue(value); 288 | repaint(); 289 | QApplication::processEvents(); 290 | QApplication::processEvents(); 291 | } 292 | 293 | void JKQTEProgressListDialog::setProgressText(const QString &text) 294 | { 295 | labProgress->setText(text); 296 | repaint(); 297 | QApplication::processEvents(); 298 | QApplication::processEvents(); 299 | } 300 | 301 | void JKQTEProgressListDialog::setLabelText(const QString &text) 302 | { 303 | setProgressText(text); 304 | } 305 | 306 | void JKQTEProgressListDialog::setCancelButtonText(const QString &text) 307 | { 308 | btnCancel->setText(text); 309 | repaint(); 310 | QApplication::processEvents(); 311 | QApplication::processEvents(); 312 | } 313 | 314 | void JKQTEProgressListDialog::addItem(const QString &text, int status) 315 | { 316 | list->addItem(text, status); 317 | repaint(); 318 | QApplication::processEvents(); 319 | QApplication::processEvents(); 320 | } 321 | 322 | int JKQTEProgressListDialog::count() const 323 | { 324 | return list->count(); 325 | } 326 | 327 | void JKQTEProgressListDialog::setHasCancelButton(bool hasCancel, bool cancelRejects) 328 | { 329 | btnCancel->setVisible(hasCancel); 330 | m_cancelRejects=cancelRejects; 331 | } 332 | 333 | void JKQTEProgressListDialog::setHasProgressBar(bool hasProg) { 334 | m_hasProgressBar=hasProg; 335 | labProgress->setVisible(m_hasProgressBar); 336 | progress->setVisible(m_hasProgressBar); 337 | progressLine->setVisible(m_hasProgressBar); 338 | } 339 | 340 | bool JKQTEProgressListDialog::wasCanceled() const 341 | { 342 | return m_wasCanceled; 343 | } 344 | 345 | JKQTEProgressListWidget * JKQTEProgressListDialog::getProgressList() const 346 | { 347 | return list; 348 | } 349 | 350 | void JKQTEProgressListDialog::reset() 351 | { 352 | list->reset(); 353 | QApplication::processEvents(); 354 | QApplication::processEvents(); 355 | } 356 | 357 | void JKQTEProgressListWidget::reset() 358 | { 359 | for (int i=0; iJKQTEProgressListWidget::statusNone && m_status[i]) 3 | 4 | This software is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License (LGPL) as published by 6 | the Free Software Foundation, either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License (LGPL) for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License (LGPL) 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include "jkqtedoubleedit.h" 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | JKQTEDoubleEdit::JKQTEDoubleEdit(QWidget* parent): 28 | QLineEdit(parent) 29 | { 30 | JKDoubleEdit_BASIC_REGEXP=QString("(\\+|\\-)?\\d+("+QString(QLocale::system().decimalPoint())+"\\d+)?((e|E)(\\+|\\-)?\\d+)?"); 31 | setMinimumHeight(22); 32 | 33 | m_Integer=false; 34 | m_checkMaximum=true; 35 | m_maximum=100; 36 | m_checkMinimum=true; 37 | m_minimum=-100; 38 | m_decimals=6; 39 | m_increment=true; 40 | m_current=1; 41 | 42 | m_btnUp=new QToolButton(this); 43 | m_btnUp->setText("+"); 44 | Q_INIT_RESOURCE(jkqtedoubleedit); 45 | if (QFile::exists(":/jkqtedoubleedit/btn_up.png")) { 46 | m_btnUp->setIcon(QIcon(":/jkqtedoubleedit/btn_up.png")); 47 | m_btnUp->setToolButtonStyle(Qt::ToolButtonIconOnly); 48 | } 49 | m_btnDown=new QToolButton(this); 50 | m_btnDown->setText("-"); 51 | if (QFile::exists(":/jkqtedoubleedit/btn_down.png")) { 52 | m_btnDown->setIcon(QIcon(":/jkqtedoubleedit/btn_down.png")); 53 | m_btnDown->setToolButtonStyle(Qt::ToolButtonIconOnly); 54 | } 55 | QFont f=font(); 56 | f.setPointSizeF(f.pointSizeF()*4.0/5.0); 57 | m_btnUp->setFont(f); 58 | m_btnDown->setFont(f); 59 | m_btnDown->setCursor(QCursor(Qt::ArrowCursor)); 60 | m_btnUp->setCursor(QCursor(Qt::ArrowCursor)); 61 | m_btnDown->setFocusPolicy(Qt::NoFocus); 62 | m_btnUp->setFocusPolicy(Qt::NoFocus); 63 | m_btnDown->setAutoRepeat(true); 64 | m_btnUp->setAutoRepeat(true); 65 | connect(m_btnUp, SIGNAL(clicked()), this, SLOT(stepUp())); 66 | connect(m_btnDown, SIGNAL(clicked()), this, SLOT(stepDown())); 67 | 68 | int btnWidth=ceil((double)height()*3.0/4.0); 69 | int btnHeight=qMax(22,height())/2; 70 | m_btnUp->move(width()-btnWidth, 0); 71 | m_btnUp->resize(btnWidth, btnHeight); 72 | m_btnDown->move(width()-btnWidth, btnHeight-1); 73 | m_btnDown->resize(btnWidth, height()-btnHeight); 74 | 75 | setMinimumHeight(22); 76 | 77 | 78 | 79 | m_regexp=QRegExp(JKDoubleEdit_BASIC_REGEXP, Qt::CaseSensitive, QRegExp::RegExp); 80 | m_validator=new QRegExpValidator(m_regexp, this); 81 | setValidator(m_validator); 82 | connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateWidget(const QString &))); 83 | m_background=palette().color(QPalette::Base); 84 | m_errorColor=QColor("darksalmon"); 85 | m_noIntegerBackgroundColor=QColor("peachpuff"); 86 | setValue(0); 87 | setShowUpDown(true); 88 | } 89 | 90 | JKQTEDoubleEdit::~JKQTEDoubleEdit() 91 | { 92 | //dtor 93 | } 94 | 95 | double JKQTEDoubleEdit::value() const { 96 | bool ok=true; 97 | double val=locale().toDouble(text(), &ok); 98 | //qDebug()<<"value() ==> text()="< val="<m_maximum)) { value=m_maximum; } 112 | if (m_checkMinimum && (value text()="<0) { 132 | if (!text[text.size()-1].isDigit()) return; 133 | if (text[text.size()-1]==QChar('0') && text.contains(QLocale::system().decimalPoint()) && (!(text.contains('e') || text.contains('E')))) return; 134 | } 135 | bool ok=true; 136 | double val=text.toDouble(&ok); 137 | if (!ok) return; 138 | double newVal=val; 139 | //palette().setColor(QPalette::Base, m_background); 140 | ok=true; 141 | if (m_checkMaximum && (val>m_maximum)) { ok=false; newVal=m_maximum; } 142 | if (m_checkMinimum && (val