Tools: [skip ci] fix linking errors of designer plugin with MSVC

This commit is contained in:
wmayer
2022-04-06 12:47:28 +02:00
parent 9442668f7a
commit 2dde41c054
4 changed files with 41 additions and 5 deletions

View File

@@ -93,7 +93,7 @@ macro(PrintFinalReport)
message(STATUS "Qt5WebEngineWidgets: not needed (BUILD_WEB)")
endif(BUILD_WEB)
if(BUILD_DESIGNER_PLUGIN)
message(STATUS "Designer plugin: ${DESIGNER_PLUGIN_LOCATION}/libFreeCAD_widgets.so")
message(STATUS "Designer plugin: ${DESIGNER_PLUGIN_LOCATION}/${libFreeCAD_widgets}")
else(BUILD_DESIGNER_PLUGIN)
message(STATUS "Designer plugin: not built per user request (BUILD_DESIGNER_PLUGIN)")
endif(BUILD_DESIGNER_PLUGIN)

View File

@@ -20,8 +20,35 @@ add_library(FreeCAD_widgets SHARED
plugin.h
)
set(FreeCAD_widgets_LIBS
${Qt5Widgets_LIBRARIES}
${Qt5Designer_LIBRARIES}
)
if(MSVC)
list(APPEND FreeCAD_widgets_LIBS
debug msvcrtd.lib
debug msvcprtd.lib
optimized msvcrt.lib
optimized msvcprt.lib
)
#Universal C runtime introduced in VS 2015 (cl version 19)
if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19"))
list(APPEND FreeCAD_widgets_LIBS
debug vcruntimed.lib
debug ucrtd.lib
debug concrtd.lib
optimized vcruntime.lib
optimized ucrt.lib
optimized concrt.lib
)
endif()
endif()
target_link_libraries(FreeCAD_widgets PRIVATE ${Qt5Widgets_LIBRARIES} ${Qt5Designer_LIBRARIES})
target_compile_options(FreeCAD_widgets PRIVATE ${COMPILE_OPTIONS})
set (libFreeCAD_widgets "libFreeCAD_widgets" PARENT_SCOPE)
# Get the install location of a plugin to determine the path to designer plguins

View File

@@ -140,7 +140,7 @@ void LocationWidget::retranslateUi()
}
FileChooser::FileChooser( QWidget *parent )
: QWidget( parent ), md( File ), _filter( QString::null )
: QWidget( parent ), md( File ), _filter( QString() )
{
QHBoxLayout *layout = new QHBoxLayout( this );
layout->setMargin( 0 );
@@ -153,7 +153,11 @@ FileChooser::FileChooser( QWidget *parent )
this, SIGNAL(fileNameChanged(const QString &)));
button = new QPushButton( "...", this );
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
button->setFixedWidth(2 * button->fontMetrics().horizontalAdvance(" ... "));
#else
button->setFixedWidth(2*button->fontMetrics().width( " ... " ));
#endif
layout->addWidget( button );
connect(button, SIGNAL(clicked()), this, SLOT(chooseFile()));
@@ -216,8 +220,13 @@ void FileChooser::setFilter ( const QString& filter )
void FileChooser::setButtonText( const QString& txt )
{
button->setText( txt );
int w1 = 2*button->fontMetrics().width(txt);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
int w1 = 2 * button->fontMetrics().horizontalAdvance(txt);
int w2 = 2 * button->fontMetrics().horizontalAdvance(" ... ");
#else
int w1 = 2 * button->fontMetrics().width(txt);
int w2 = 2*button->fontMetrics().width(" ... ");
#endif
button->setFixedWidth((w1 > w2 ? w1 : w2));
}
@@ -1391,7 +1400,7 @@ void CommandIconView::startDrag ( Qt::DropActions /*supportedActions*/ )
drag->setMimeData(mimeData);
drag->setHotSpot(QPoint(pixmap.width()/2, pixmap.height()/2));
drag->setPixmap(pixmap);
drag->start(Qt::MoveAction);
drag->exec(Qt::MoveAction);
}
void CommandIconView::onSelectionChanged(QListWidgetItem * item, QListWidgetItem *)

View File

@@ -158,7 +158,7 @@ class UrlLabel : public QLabel
Q_PROPERTY( QString url READ url WRITE setUrl)
public:
UrlLabel ( QWidget * parent = 0, Qt::WindowFlags f = 0 );
UrlLabel ( QWidget * parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
virtual ~UrlLabel();
QString url() const;