Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shared/icon-label: Prevent moc from being appended to global file #11356

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shared/properties-view/properties-view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <qt-wrappers.hpp>
#include <plain-text-edit.hpp>
#include <slider-ignorewheel.hpp>
#include <icon-label.hpp>
#include <IconLabel.hpp>
#include <cstdlib>
#include <initializer_list>
#include <obs-data.h>
Expand Down
2 changes: 1 addition & 1 deletion shared/qt/icon-label/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ find_package(Qt6 REQUIRED Core Widgets)
add_library(qt-icon-label INTERFACE)
add_library(OBS::qt-icon-label ALIAS qt-icon-label)

target_sources(qt-icon-label INTERFACE icon-label.hpp)
target_sources(qt-icon-label INTERFACE IconLabel.cpp IconLabel.hpp)
target_include_directories(qt-icon-label INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")

target_link_libraries(qt-icon-label INTERFACE Qt::Core Qt::Widgets)
29 changes: 29 additions & 0 deletions shared/qt/icon-label/IconLabel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/******************************************************************************
Copyright (C) 2024 by Sebastian Beckmann

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/

#include "moc_IconLabel.cpp"

void IconLabel::setIcon(const QIcon &icon)
{
m_icon = icon;
QLabel::setPixmap(icon.pixmap(m_iconSize));
}

void IconLabel::setIconSize(int newSize)
{
m_iconSize = newSize;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@ class IconLabel : public QLabel {
inline IconLabel(QWidget *parent = nullptr) : QLabel(parent), m_icon(), m_iconSize(16) {}

inline QIcon icon() const { return m_icon; }
void setIcon(const QIcon &icon)
{
m_icon = icon;
QLabel::setPixmap(icon.pixmap(m_iconSize));
}
void setIcon(const QIcon &icon);

inline int iconSize() const { return m_iconSize; }
void setIconSize(int newSize) { m_iconSize = newSize; }
void setIconSize(int newSize);

private:
QIcon m_icon;
Expand Down
Loading