[qet] [3747] port to Qt5

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 3747
Author:   blacksun
Date:     2015-02-21 21:54:19 +0100 (Sat, 21 Feb 2015)
Log Message:
-----------
port to Qt5

Modified Paths:
--------------
    branches/Qt5/sources/dvevent/dveventaddimage.cpp
    branches/Qt5/sources/dvevent/dveventaddshape.cpp
    branches/Qt5/sources/editor/elementscene.cpp
    branches/Qt5/sources/editor/esevent/eseventinterface.cpp
    branches/Qt5/sources/editor/graphicspart/parttext.cpp
    branches/Qt5/sources/editor/graphicspart/parttextfield.cpp
    branches/Qt5/sources/genericpanel.cpp
    branches/Qt5/sources/qetgraphicsitem/conductor.cpp
    branches/Qt5/sources/qetgraphicsitem/conductortextitem.cpp
    branches/Qt5/sources/qetgraphicsitem/diagramimageitem.cpp
    branches/Qt5/sources/qetgraphicsitem/diagramtextitem.cpp
    branches/Qt5/sources/qetgraphicsitem/element.cpp
    branches/Qt5/sources/qetgraphicsitem/terminal.cpp
    branches/Qt5/sources/qetprintpreviewdialog.cpp
    branches/Qt5/sources/qtextorientationwidget.cpp
    branches/Qt5/sources/richtext/richtexteditor.cpp
    branches/Qt5/sources/richtext/richtexteditor_p.h
    branches/Qt5/sources/richtext/ui_addlinkdialog.h
    branches/Qt5/sources/titleblock/templatelogomanager.cpp
    branches/Qt5/sources/titleblocktemplate.cpp
    branches/Qt5/sources/ui/conductorpropertieswidget.cpp

Modified: branches/Qt5/sources/dvevent/dveventaddimage.cpp
===================================================================
--- branches/Qt5/sources/dvevent/dveventaddimage.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/dvevent/dveventaddimage.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -21,6 +21,7 @@
 #include "diagramview.h"
 #include "diagram.h"
 #include <QObject>
+#include <QStandardPaths>
 
 /**
  * @brief DVEventAddImage::DVEventAddImage
@@ -142,7 +143,7 @@
 	if (m_diagram -> isReadOnly()) return;
 
 	//Open dialog for select image
-	QString pathPictures = QDesktopServices::storageLocation ( QDesktopServices::PicturesLocation );
+	QString pathPictures = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
 	QString fileName = QFileDialog::getOpenFileName(m_dv, QObject::tr("Selectionner une image..."), pathPictures, QObject::tr("Image Files (*.png *.jpg *.bmp *.svg)"));
 
 	if (fileName.isEmpty()) return;

Modified: branches/Qt5/sources/dvevent/dveventaddshape.cpp
===================================================================
--- branches/Qt5/sources/dvevent/dveventaddshape.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/dvevent/dveventaddshape.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -194,16 +194,14 @@
 		if (!m_help_horiz)
 		{
 			m_help_horiz = new QGraphicsLineItem(m_diagram -> border_and_titleblock.rowsHeaderWidth() + 5, 0,
-												 m_diagram -> border_and_titleblock.diagramWidth() + 5, 0,
-												 0, m_diagram);
+												 m_diagram -> border_and_titleblock.diagramWidth() + 5, 0);
 			m_help_horiz->setPen(pen);
 		}
 
 		if (!m_help_verti)
 		{
 			m_help_verti = new QGraphicsLineItem(0, m_diagram -> border_and_titleblock.columnsHeaderHeight() + 5,
-												 0, m_diagram -> border_and_titleblock.diagramHeight() + 5,
-												 0, m_diagram);
+												 0, m_diagram -> border_and_titleblock.diagramHeight() + 5);
 			m_help_verti->setPen(pen);
 		}
 	}

Modified: branches/Qt5/sources/editor/elementscene.cpp
===================================================================
--- branches/Qt5/sources/editor/elementscene.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/editor/elementscene.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -968,9 +968,9 @@
 	int center_y = qRound(size.center().y());
 
 	//define the movement of translation
-	int move_x = center_x - (qRound(center_x) %10);
+	int move_x = center_x - (center_x %10);
 	if (center_x < 0) move_x -= 10;
-	int move_y = center_y - (qRound(center_y) %10);
+	int move_y = center_y - (center_y %10);
 	if (center_y < 0) move_y -= 10;
 
 		//move each primitive by @move

Modified: branches/Qt5/sources/editor/esevent/eseventinterface.cpp
===================================================================
--- branches/Qt5/sources/editor/esevent/eseventinterface.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/editor/esevent/eseventinterface.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -109,11 +109,11 @@
 		pen.setCosmetic(true);
 		pen.setColor(Qt::darkGray);
 		if (!m_help_horiz) {
-			m_help_horiz = new QGraphicsLineItem(-10000, 0, 10000, 0, 0, m_scene);
+			m_help_horiz = new QGraphicsLineItem(-10000, 0, 10000, 0);
 			m_help_horiz -> setPen(pen);
 		}
 		if (!m_help_verti) {
-			m_help_verti = new QGraphicsLineItem(0, -10000, 0, 10000, 0, m_scene);
+			m_help_verti = new QGraphicsLineItem(0, -10000, 0, 10000);
 			m_help_verti -> setPen(pen);
 		}
 	}

Modified: branches/Qt5/sources/editor/graphicspart/parttext.cpp
===================================================================
--- branches/Qt5/sources/editor/graphicspart/parttext.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/editor/graphicspart/parttext.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -29,11 +29,12 @@
 	@param scene La scene sur laquelle figure ce texte statique
 */
 PartText::PartText(QETElementEditor *editor, QGraphicsItem *parent, ElementScene *scene) :
-	QGraphicsTextItem(parent, scene),
+	QGraphicsTextItem(parent),
 	CustomElementPart(editor),
 	previous_text(),
 	decorator_(0)
 {
+	Q_UNUSED(scene)
 #if QT_VERSION >= 0x040500
 	document() -> setDocumentMargin(1.0);
 #endif

Modified: branches/Qt5/sources/editor/graphicspart/parttextfield.cpp
===================================================================
--- branches/Qt5/sources/editor/graphicspart/parttextfield.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/editor/graphicspart/parttextfield.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -28,13 +28,14 @@
 	@param scene La scene sur laquelle figure ce champ de texte
 */
 PartTextField::PartTextField(QETElementEditor *editor, QGraphicsItem *parent, QGraphicsScene *scene) :
-	QGraphicsTextItem(parent, scene),
+	QGraphicsTextItem(parent),
 	CustomElementPart(editor),
 	follow_parent_rotations(true),
 	m_tagg("none"),
 	previous_text(),
 	decorator_(0)
 {
+	Q_UNUSED(scene);
 	setDefaultTextColor(Qt::black);
 	setFont(QETApp::diagramTextsFont());
 	real_font_size_ = font().pointSize();

Modified: branches/Qt5/sources/genericpanel.cpp
===================================================================
--- branches/Qt5/sources/genericpanel.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/genericpanel.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -1226,7 +1226,7 @@
 */
 template<typename T>
 T GenericPanel::valueForItem(QTreeWidgetItem *item) const {
-	return(qVariantValue<T>(item -> data(0, GenericPanel::Item)));
+	return item -> data(0, GenericPanel::Item).value<T>();
 }
 template TitleBlockTemplateLocation
 GenericPanel::valueForItem(QTreeWidgetItem *item) const;

Modified: branches/Qt5/sources/qetgraphicsitem/conductor.cpp
===================================================================
--- branches/Qt5/sources/qetgraphicsitem/conductor.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/qetgraphicsitem/conductor.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -87,7 +87,7 @@
 	// calcul du rendu du conducteur
 	generateConductorPath(terminal1 -> dockConductor(), terminal1 -> orientation(), terminal2 -> dockConductor(), terminal2 -> orientation());
 	setFlags(QGraphicsItem::ItemIsSelectable);
-	setAcceptsHoverEvents(true);
+	setAcceptHoverEvents(true);
 	
 	// ajout du champ de texte editable
 	text_item = new ConductorTextItem(properties_.text, this);

Modified: branches/Qt5/sources/qetgraphicsitem/conductortextitem.cpp
===================================================================
--- branches/Qt5/sources/qetgraphicsitem/conductortextitem.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/qetgraphicsitem/conductortextitem.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -31,7 +31,7 @@
 	moved_by_user_(false),
 	rotate_by_user_(false)
 {
-	setAcceptsHoverEvents(true);
+	setAcceptHoverEvents(true);
 }
 
 /**

Modified: branches/Qt5/sources/qetgraphicsitem/diagramimageitem.cpp
===================================================================
--- branches/Qt5/sources/qetgraphicsitem/diagramimageitem.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/qetgraphicsitem/diagramimageitem.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -201,7 +201,7 @@
 
 	//load xml image to QByteArray
 	QByteArray array;
-	array = QByteArray::fromBase64(e.text().toAscii());
+	array = QByteArray::fromBase64(e.text().toLatin1());
 
 	//Set QPixmap from the @array
 	QPixmap pixmap;

Modified: branches/Qt5/sources/qetgraphicsitem/diagramtextitem.cpp
===================================================================
--- branches/Qt5/sources/qetgraphicsitem/diagramtextitem.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/qetgraphicsitem/diagramtextitem.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -33,7 +33,7 @@
 	rotation_angle_(0.0),
 	m_first_move (true)
 {
-	setAcceptsHoverEvents(true);
+	setAcceptHoverEvents(true);
 	build();
 }
 
@@ -50,7 +50,7 @@
 	rotation_angle_(0.0)
 {
 	build();
-	setAcceptsHoverEvents(true);
+	setAcceptHoverEvents(true);
 }
 
 /// Destructeur

Modified: branches/Qt5/sources/qetgraphicsitem/element.cpp
===================================================================
--- branches/Qt5/sources/qetgraphicsitem/element.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/qetgraphicsitem/element.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -39,7 +39,7 @@
 	uuid_ = QUuid::createUuid();
 	setZValue(10);
 	setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
-	setAcceptsHoverEvents(true);
+	setAcceptHoverEvents(true);
 }
 
 /**

Modified: branches/Qt5/sources/qetgraphicsitem/terminal.cpp
===================================================================
--- branches/Qt5/sources/qetgraphicsitem/terminal.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/qetgraphicsitem/terminal.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -64,7 +64,7 @@
 	br_ = new QRectF();
 	previous_terminal_ = 0;
 	// divers
-	setAcceptsHoverEvents(true);
+	setAcceptHoverEvents(true);
 	setAcceptedMouseButtons(Qt::LeftButton);
 	hovered_ = false;
 	setToolTip(QObject::tr("Borne", "tooltip"));
@@ -588,7 +588,7 @@
 		d -> setConductor(false);
 
 			//Get item under cursor
-		QGraphicsItem *qgi = d -> itemAt(e -> scenePos());
+		QGraphicsItem *qgi = d -> itemAt(e -> scenePos(), QTransform());
 		if (!qgi) return;
 
 			//Element must be a terminal

Modified: branches/Qt5/sources/qetprintpreviewdialog.cpp
===================================================================
--- branches/Qt5/sources/qetprintpreviewdialog.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/qetprintpreviewdialog.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -22,6 +22,7 @@
 #include "qeticons.h"
 
 #include <QPrintPreviewWidget>
+#include <QPageSetupDialog>
 
 /**
 	Constructeur
@@ -92,14 +93,14 @@
 */
 void QETPrintPreviewDialog::nextPage() {
 	int preview_next_page = preview_ -> currentPage() + 1;
-	preview_ -> setCurrentPage(qMin(preview_next_page, preview_ -> numPages()));
+	preview_ -> setCurrentPage(qMin(preview_next_page, preview_ -> pageCount()));
 }
 
 /**
 	Passe a la derniere page
 */
 void QETPrintPreviewDialog::lastPage() {
-	preview_ -> setCurrentPage(preview_ -> numPages());
+	preview_ -> setCurrentPage(preview_ -> pageCount());
 }
 
 /**

Modified: branches/Qt5/sources/qtextorientationwidget.cpp
===================================================================
--- branches/Qt5/sources/qtextorientationwidget.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/qtextorientationwidget.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -246,7 +246,7 @@
 void QTextOrientationWidget::mouseMoveEvent(QMouseEvent *event) {
 	if (read_only_) return;
 	
-	bool drawn_angle_hovered = positionIsASquare(event -> posF(), &highlight_angle_);
+	bool drawn_angle_hovered = positionIsASquare(event -> localPos(), &highlight_angle_);
 	
 	if (must_highlight_angle_ != drawn_angle_hovered) {
 		must_highlight_angle_ = drawn_angle_hovered;
@@ -262,7 +262,7 @@
 	if (read_only_) return;
 	
 	double clicked_angle;
-	bool drawn_angle_clicked = positionIsASquare(event -> posF(), &clicked_angle);
+	bool drawn_angle_clicked = positionIsASquare(event -> localPos(), &clicked_angle);
 	
 	if (drawn_angle_clicked) {
 		setOrientation(clicked_angle);

Modified: branches/Qt5/sources/richtext/richtexteditor.cpp
===================================================================
--- branches/Qt5/sources/richtext/richtexteditor.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/richtext/richtexteditor.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -48,7 +48,7 @@
 #include "richtexteditor_p.h"
 #include "ui_addlinkdialog.h"
 
-#include <QtDesigner/QDesignerFormEditorInterface>
+//#include <QtDesigner/QDesignerFormEditorInterface>
 
 #include <QtCore/QList>
 #include <QtCore/QMap>
@@ -57,24 +57,24 @@
 #include <QtCore/QXmlStreamWriter>
 #include <QtCore/QXmlStreamAttributes>
 
-#include <QtGui/QAction>
-#include <QtGui/QColorDialog>
-#include <QtGui/QComboBox>
+#include <QAction>
+#include <QColorDialog>
+#include <QComboBox>
 #include <QtGui/QFontDatabase>
 #include <QtGui/QTextCursor>
 #include <QtGui/QPainter>
 #include <QtGui/QIcon>
-#include <QtGui/QMenu>
+#include <QMenu>
 #include <QtGui/QMoveEvent>
-#include <QtGui/QTabWidget>
+#include <QTabWidget>
 #include <QtGui/QTextDocument>
 #include <QtGui/QTextBlock>
-#include <QtGui/QToolBar>
-#include <QtGui/QToolButton>
-#include <QtGui/QVBoxLayout>
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QPushButton>
-#include <QtGui/QDialogButtonBox>
+#include <QToolBar>
+#include <QToolButton>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QPushButton>
+#include <QDialogButtonBox>
 
 QT_BEGIN_NAMESPACE
 
@@ -731,7 +731,6 @@
 QString RichTextEditor::text(Qt::TextFormat format) const
 {
     switch (format) {
-    case Qt::LogText:
     case Qt::PlainText:
         return toPlainText();
     case Qt::RichText:

Modified: branches/Qt5/sources/richtext/richtexteditor_p.h
===================================================================
--- branches/Qt5/sources/richtext/richtexteditor_p.h	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/richtext/richtexteditor_p.h	2015-02-21 20:54:19 UTC (rev 3747)
@@ -53,8 +53,8 @@
 #ifndef RICHTEXTEDITOR_H
 #define RICHTEXTEDITOR_H
 
-#include <QtGui/QTextEdit>
-#include <QtGui/QDialog>
+#include <QDialog>
+#include <QTextEdit>
 
 QT_BEGIN_NAMESPACE
 

Modified: branches/Qt5/sources/richtext/ui_addlinkdialog.h
===================================================================
--- branches/Qt5/sources/richtext/ui_addlinkdialog.h	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/richtext/ui_addlinkdialog.h	2015-02-21 20:54:19 UTC (rev 3747)
@@ -11,18 +11,18 @@
 #define UI_ADDLINKDIALOG_H
 
 #include <QtCore/QVariant>
-#include <QtGui/QAction>
-#include <QtGui/QApplication>
-#include <QtGui/QButtonGroup>
-#include <QtGui/QDialog>
-#include <QtGui/QDialogButtonBox>
-#include <QtGui/QFormLayout>
-#include <QtGui/QFrame>
-#include <QtGui/QHeaderView>
-#include <QtGui/QLabel>
-#include <QtGui/QLineEdit>
-#include <QtGui/QSpacerItem>
-#include <QtGui/QVBoxLayout>
+#include <QAction>
+#include <QApplication>
+#include <QButtonGroup>
+#include <QDialog>
+#include <QDialogButtonBox>
+#include <QFormLayout>
+#include <QFrame>
+#include <QHeaderView>
+#include <QLabel>
+#include <QLineEdit>
+#include <QSpacerItem>
+#include <QVBoxLayout>
 
 QT_BEGIN_NAMESPACE
 
@@ -101,9 +101,9 @@
 
     void retranslateUi(QDialog *AddLinkDialog)
     {
-        AddLinkDialog->setWindowTitle(QApplication::translate("AddLinkDialog", "Insert Link", 0, QApplication::UnicodeUTF8));
-        label->setText(QApplication::translate("AddLinkDialog", "Title:", 0, QApplication::UnicodeUTF8));
-        label_2->setText(QApplication::translate("AddLinkDialog", "URL:", 0, QApplication::UnicodeUTF8));
+		AddLinkDialog->setWindowTitle(QApplication::translate("AddLinkDialog", "Insert Link", 0));
+		label->setText(QApplication::translate("AddLinkDialog", "Title:", 0));
+		label_2->setText(QApplication::translate("AddLinkDialog", "URL:", 0));
     } // retranslateUi
 
 };

Modified: branches/Qt5/sources/titleblock/templatelogomanager.cpp
===================================================================
--- branches/Qt5/sources/titleblock/templatelogomanager.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/titleblock/templatelogomanager.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -19,6 +19,8 @@
 #include "titleblocktemplate.h"
 #include "qeticons.h"
 
+#include <QStandardPaths>
+
 /**
 	Constructor
 	@param managed_template Title block template this widget manages logos for.
@@ -70,7 +72,7 @@
 	Initialize widgets composing the Logo manager
 */
 void TitleBlockTemplateLogoManager::initWidgets() {
-	open_dialog_dir_ = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
+	open_dialog_dir_ = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
 	
 	setWindowTitle(tr("Gestionnaire de logos"));
 	setWindowIcon(QET::Icons::InsertImage);

Modified: branches/Qt5/sources/titleblocktemplate.cpp
===================================================================
--- branches/Qt5/sources/titleblocktemplate.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/titleblocktemplate.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -285,7 +285,7 @@
 		QTextStream xml_to_byte_array(&logo_data);
 		svg_element.save(xml_to_byte_array, 0);
 	} else if (logo_storage == "base64") {
-		logo_data = QByteArray::fromBase64(xml_element.text().toAscii());
+		logo_data = QByteArray::fromBase64(xml_element.text().toLatin1());
 	} else {
 		return(false);
 	}

Modified: branches/Qt5/sources/ui/conductorpropertieswidget.cpp
===================================================================
--- branches/Qt5/sources/ui/conductorpropertieswidget.cpp	2015-02-21 19:48:31 UTC (rev 3746)
+++ branches/Qt5/sources/ui/conductorpropertieswidget.cpp	2015-02-21 20:54:19 UTC (rev 3747)
@@ -68,7 +68,7 @@
 	m_properties = properties;
 
 	setColorButton(m_properties.color);
-	int index = ui -> m_line_style_cb->findData(m_properties.style);
+	int index = ui -> m_line_style_cb -> findData(QPen(m_properties.style));
 	if (index != -1) ui -> m_line_style_cb -> setCurrentIndex(index);
 
 	ui -> m_text_le                  -> setText    (m_properties.text);
@@ -155,9 +155,9 @@
 	m_horiz_select = QETApp::createTextOrientationSpinBoxWidget();
 	ui -> m_text_angle_gl -> addWidget(m_horiz_select, 2, 1,  Qt::AlignHCenter);
 
-	ui -> m_line_style_cb -> addItem(tr("Trait plein", "conductor style: solid line"), Qt::SolidLine);
-	ui -> m_line_style_cb -> addItem(tr("Trait en pointill\351s", "conductor style: dashed line"), Qt::DashLine);
-	ui -> m_line_style_cb -> addItem(tr("Traits et points", "conductor style: dashed and dotted line"), Qt::DashDotLine);
+	ui -> m_line_style_cb -> addItem(tr("Trait plein", "conductor style: solid line"), QPen(Qt::SolidLine));
+	ui -> m_line_style_cb -> addItem(tr("Trait en pointill\351s", "conductor style: dashed line"), QPen(Qt::DashLine));
+	ui -> m_line_style_cb -> addItem(tr("Traits et points", "conductor style: dashed and dotted line"), QPen(Qt::DashDotLine));
 
 	ui -> m_update_preview_pb -> setHidden(true);
 	//Check this checkbox for init the associated groupbox


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/