Add extended RDToolButton

This commit is contained in:
baldurk
2017-05-10 16:49:29 +01:00
parent f8bf45fa47
commit 441d136177
5 changed files with 115 additions and 0 deletions
@@ -0,0 +1,49 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include "RDToolButton.h"
#include <QMouseEvent>
RDToolButton::RDToolButton(QWidget *parent) : QToolButton(parent)
{
}
RDToolButton::~RDToolButton()
{
}
void RDToolButton::mousePressEvent(QMouseEvent *event)
{
emit(mouseClicked(event));
}
void RDToolButton::mouseMoveEvent(QMouseEvent *event)
{
emit(mouseMoved(event));
}
void RDToolButton::mouseDoubleClickEvent(QMouseEvent *event)
{
emit(doubleClicked(event));
}
@@ -0,0 +1,47 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#pragma once
#include <QToolButton>
class RDToolButton : public QToolButton
{
private:
Q_OBJECT
public:
explicit RDToolButton(QWidget *parent = 0);
~RDToolButton();
signals:
void mouseClicked(QMouseEvent *event);
void doubleClicked(QMouseEvent *event);
void mouseMoved(QMouseEvent *event);
public slots:
protected:
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
};
+2
View File
@@ -170,6 +170,7 @@ SOURCES += Code/qrenderdoc.cpp \
Widgets/Extended/RDLineEdit.cpp \
Widgets/Extended/RDTextEdit.cpp \
Widgets/Extended/RDLabel.cpp \
Widgets/Extended/RDToolButton.cpp \
Widgets/Extended/RDDoubleSpinBox.cpp \
Widgets/Extended/RDListView.cpp \
Widgets/CustomPaintWidget.cpp \
@@ -228,6 +229,7 @@ HEADERS += Code/CaptureContext.h \
Widgets/Extended/RDLineEdit.h \
Widgets/Extended/RDTextEdit.h \
Widgets/Extended/RDLabel.h \
Widgets/Extended/RDToolButton.h \
Widgets/Extended/RDDoubleSpinBox.h \
Widgets/Extended/RDListView.h \
Widgets/CustomPaintWidget.h \
+8
View File
@@ -595,6 +595,7 @@
<ClCompile Include="$(IntDir)generated\moc_RDDoubleSpinBox.cpp" />
<ClCompile Include="$(IntDir)generated\moc_RDSplitter.cpp" />
<ClCompile Include="$(IntDir)generated\moc_RDLabel.cpp" />
<ClCompile Include="$(IntDir)generated\moc_RDToolButton.cpp" />
<ClCompile Include="$(IntDir)generated\moc_RDLineEdit.cpp" />
<ClCompile Include="$(IntDir)generated\moc_RDTextEdit.cpp" />
<ClCompile Include="$(IntDir)generated\moc_MainWindow.cpp" />
@@ -652,6 +653,7 @@
<ClCompile Include="Widgets\Extended\RDDoubleSpinBox.cpp" />
<ClCompile Include="Widgets\Extended\RDSplitter.cpp" />
<ClCompile Include="Widgets\Extended\RDLabel.cpp" />
<ClCompile Include="Widgets\Extended\RDToolButton.cpp" />
<ClCompile Include="Widgets\Extended\RDListView.cpp" />
<ClCompile Include="Widgets\ResourcePreview.cpp" />
<ClCompile Include="Widgets\TextureGoto.cpp" />
@@ -904,6 +906,12 @@
<Message>MOC %(Filename).h</Message>
<Outputs>$(IntDir)generated\moc_%(Filename).cpp</Outputs>
</CustomBuild>
<CustomBuild Include="Widgets\Extended\RDToolButton.h">
<AdditionalInputs>%(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs)</AdditionalInputs>
<Command>$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I$(ProjectDir) -I$(SolutionDir)\renderdoc\api\replay -I$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015 -I$(ProjectDir)3rdparty\qt\$(Platform)\include -I$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets -I$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui -I$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore %(Fullpath) -o $(IntDir)generated\moc_%(Filename).cpp</Command>
<Message>MOC %(Filename).h</Message>
<Outputs>$(IntDir)generated\moc_%(Filename).cpp</Outputs>
</CustomBuild>
<CustomBuild Include="Widgets\Extended\RDLineEdit.h">
<AdditionalInputs>%(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs)</AdditionalInputs>
<Command>$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I$(ProjectDir) -I$(SolutionDir)\renderdoc\api\replay -I$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015 -I$(ProjectDir)3rdparty\qt\$(Platform)\include -I$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets -I$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui -I$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore %(Fullpath) -o $(IntDir)generated\moc_%(Filename).cpp</Command>
@@ -594,6 +594,12 @@
<ClCompile Include="Code\precompiled.cpp">
<Filter>PCH</Filter>
</ClCompile>
<ClCompile Include="Widgets\Extended\RDToolButton.cpp">
<Filter>Widgets\Extended</Filter>
</ClCompile>
<ClCompile Include="$(IntDir)generated\moc_RDToolButton.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="3rdparty\flowlayout\FlowLayout.h">
@@ -1361,5 +1367,8 @@
<CustomBuild Include="Windows\PythonShell.ui">
<Filter>Windows</Filter>
</CustomBuild>
<CustomBuild Include="Widgets\Extended\RDToolButton.h">
<Filter>Widgets\Extended</Filter>
</CustomBuild>
</ItemGroup>
</Project>