mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-06 13:40:52 +01:00
Merge branch 'master' into terminal_strip
* master: BugFix : default element collection path is wrong snap: Remove framework snap prompt Update translation and add cn chinese ts files Danish translation updated Danish translation Danish translation Add new thumbnail element Flatpak add --share=network Flatpak : add --socket=cups see : https://github.com/flathub/org.libreoffice.LibreOffice/issues/90 Graphics item handler is bigger when overred Add toolbar widget for edit size of handler in diagram editor. Fix Multiple translation in elements Fix Multiple translation in elements Fix segfault. new Analog-In - Module cleanup and upgraded elements modified: lang/qet_nl.qm modified: lang/qet_nl.ts Add Russian translation, thanks "А.Разживин" little modification in hungarian language Fixed typo
This commit is contained in:
@@ -18,6 +18,9 @@
|
||||
#include "qetutils.h"
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QGraphicsView>
|
||||
#include "../qetapp.h"
|
||||
#include "../qetdiagrameditor.h"
|
||||
|
||||
/**
|
||||
@brief QETUtils::marginsToString
|
||||
@@ -57,3 +60,30 @@ QMargins QETUtils::marginsFromString(const QString &string)
|
||||
|
||||
return margins;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETUtils::graphicsHandlerSize
|
||||
* @param item
|
||||
* @return Return the handler size to use in the QGraphicsScene of @a item.
|
||||
* If size can't be found, return 10 by default.
|
||||
*/
|
||||
qreal QETUtils::graphicsHandlerSize(QGraphicsItem *item)
|
||||
{
|
||||
if (const auto scene_ = item->scene())
|
||||
{
|
||||
if (!scene_->views().isEmpty())
|
||||
{
|
||||
if (const auto editor_ = QETApp::instance()->diagramEditorAncestorOf(scene_->views().at(0)))
|
||||
{
|
||||
const auto variant_ = editor_->property("graphics_handler_size");
|
||||
//If variant_ can't be converted to qreal, the returned qreal is 0.0
|
||||
//it's sufficient for us to check if value is set or not.
|
||||
if (const auto value_ = variant_.toReal())
|
||||
return value_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Default value
|
||||
return 10;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
#include <QMargins>
|
||||
#include <QWeakPointer>
|
||||
|
||||
class RealTerminal;
|
||||
class QGraphicsItem;
|
||||
|
||||
/**
|
||||
Provide some small utils function
|
||||
*/
|
||||
@@ -29,6 +30,7 @@ namespace QETUtils
|
||||
{
|
||||
QString marginsToString(const QMargins &margins);
|
||||
QMargins marginsFromString(const QString &string);
|
||||
qreal graphicsHandlerSize(QGraphicsItem *item);
|
||||
|
||||
template <typename T>
|
||||
QVector<QWeakPointer<T>> sharedVectorToWeak(const QVector<QSharedPointer<T>> &vector)
|
||||
|
||||
Reference in New Issue
Block a user