Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 9c97d384 authored by Tomas Mecir's avatar Tomas Mecir

Port some more things away from qt3

parent bc33b87f
......@@ -19,7 +19,6 @@
#define CMAPCLIPBOARD_H
#include <qobject.h>
#include <q3valuelist.h>
#include <kconfiggroup.h>
class KAction;
......
......@@ -31,7 +31,6 @@
#include <QQueue>
#include <qtimer.h>
#include <q3valuelist.h>
#include <Q3PtrList>
#include "cmapzone.h"
......
......@@ -284,7 +284,7 @@ void CMapPath::drawPath(QPainter *p,CMapZone *zone,QPoint offset,QColor color,in
{
if (tempPathCords.count()>1)
{
QPoint temp = *(tempPathCords.at(1));
QPoint temp = tempPathCords.at(1);
int count = 0;
......@@ -406,7 +406,7 @@ bool CMapPath::mouseInElement(QPoint mousePos)
if (tempPathCords.count()>1)
{
QPoint temp = *tempPathCords.at(1);
QPoint temp = tempPathCords.at(1);
for( PointList::Iterator point = tempPathCords.begin(); point != tempPathCords.end(); ++point )
{
......@@ -539,7 +539,7 @@ CMapElement *CMapPath::copy(void)
/** Used to add a bend to the path */
int CMapPath::addBend(QPoint pos)
{
if (bendList.contains(pos)>-1)
if (bendList.contains(pos))
return -1;
if (bendList.count()==0)
......@@ -584,7 +584,7 @@ int CMapPath::addBend(QPoint pos)
if (r.contains(pos))
{
bendList.insert(bendList.at(count),pos);
bendList.insert(count, pos);
return count;
}
x1 = (*point).x();
......@@ -599,7 +599,7 @@ int CMapPath::addBend(QPoint pos)
/** Used to add a bend to the path */
void CMapPath::addBendWithUndo(QPoint pos)
{
if (bendList.contains(pos)>-1)
if (bendList.contains(pos))
return;
CMapCmdElementProperties *cmdAddBend = new CMapCmdElementProperties(getManager(),i18n("Add Bend"),this);
......@@ -613,7 +613,7 @@ void CMapPath::moveBendWithUndo(int bend, QPoint pos)
{
if (bend>0 && bend-1 < (int)bendList.count())
{
QPoint oldPos = *(bendList.at(bend-1));
QPoint oldPos = bendList.at(bend-1);
CMapCmdElementProperties *cmdMoveBend = new CMapCmdElementProperties(getManager(),i18n("Move Bend"),this);
cmdMoveBend->getNewProperties().writeEntry("MoveBendPos",pos);
cmdMoveBend->getNewProperties().writeEntry("MoveBendBend",bend);
......@@ -863,7 +863,7 @@ void CMapPath::moveBend(int bend, QPoint pos)
{
if (bend>0 && bend-1 < (int)bendList.count())
{
(*bendList.at(bend-1)) = pos;
bendList.replace(bend-1, pos);
getManager()->changedElement(this);
}
}
......@@ -872,26 +872,16 @@ void CMapPath::moveBend(int bend, QPoint pos)
* @param seg The path segment number to delete */
QPoint CMapPath::deletePathSeg(int seg)
{
QPoint deletedPos;
PointList::Iterator pos;
QPoint deletedPos;
for( PointList::Iterator point = bendList.begin(); point != bendList.end(); ++point )
{
kDebug() << "Bend : " << (*point).x() << "," << (*point).y();
}
if (seg >= (int)bendList.count())
{
pos =bendList.at(bendList.count()-1);
deletedPos = (*pos);
}
else
{
pos =bendList.at(seg-1);
deletedPos = (*pos);
}
for( PointList::Iterator point = bendList.begin(); point != bendList.end(); ++point )
{
kDebug() << "Bend : " << (*point).x() << "," << (*point).y();
}
return deletedPos;
if (seg > (int) bendList.count()) seg = bendList.count();
deletedPos = bendList.at(seg - 1);
return deletedPos;
}
/**
......
......@@ -19,7 +19,7 @@
#define CMAPPATH_H
#include <qrect.h>
#include <q3valuelist.h>
#include <QList>
#include "cmapelement.h"
......@@ -182,7 +182,7 @@ private:
QRect getBoundRectOfSeg(QPoint pos1,QPoint pos2);
private:
typedef Q3ValueList<QPoint> PointList;
typedef QList<QPoint> PointList;
/** If this is greater than 0 then the bend will not be painted */
int m_dontPaintBend;
......
......@@ -21,7 +21,6 @@
#include <qfont.h>
#include <qstring.h>
#include <qcolor.h>
#include <q3strlist.h>
#include <qpoint.h>
#include "cmapmanager.h"
......
......@@ -18,7 +18,6 @@
#include "cmapwidget.h"
#include <QBitmap>
#include <Q3PopupMenu>
#include <QScrollArea>
#include <kapplication.h>
#include <kactioncollection.h>
......@@ -66,10 +65,10 @@ CMapWidget::~CMapWidget()
/** Used to create the element context menus */
void CMapWidget::initContexMenus(void)
{
room_menu = (Q3PopupMenu *)getView()->guiFactory()->container("room_popup",getView());
text_menu = (Q3PopupMenu *)getView()->guiFactory()->container("text_popup",getView());
path_menu = (Q3PopupMenu *)getView()->guiFactory()->container("path_popup",getView());
empty_menu = (Q3PopupMenu *)getView()->guiFactory()->container("empty_popup",getView());
room_menu = (QMenu *)getView()->guiFactory()->container("room_popup",getView());
text_menu = (QMenu *)getView()->guiFactory()->container("text_popup",getView());
path_menu = (QMenu *)getView()->guiFactory()->container("path_popup",getView());
empty_menu = (QMenu *)getView()->guiFactory()->container("empty_popup",getView());
}
/** Used to get the views */
......@@ -281,7 +280,7 @@ void CMapWidget::showOtherContextMenu(void)
showContextMenu (empty_menu);
}
void CMapWidget::showContextMenu(Q3PopupMenu *menu)
void CMapWidget::showContextMenu(QMenu *menu)
{
CMapView *view = mapManager->getActiveView();
CMapElement *el = view->getSelectedElement();
......@@ -317,7 +316,7 @@ void CMapWidget::showContexMenu(QMouseEvent *e)
}
/** This method is used to tell the plugins a menu is about to open then open the menu */
void CMapWidget::popupMenu(CMapElement *element,Q3PopupMenu *menu,QPoint pos)
void CMapWidget::popupMenu(CMapElement *element,QMenu *menu,QPoint pos)
{
if (element) {
for (CMapPluginBase *plugin = mapManager->getPluginList()->first();plugin!=0;plugin = mapManager->getPluginList()->next())
......
......@@ -18,16 +18,10 @@
#ifndef CMAPWIDGET_H
#define CMAPWIDGET_H
#include <qwidget.h>
#include <QWidget>
#include <q3scrollview.h>
#include <qtooltip.h>
#include <q3popupmenu.h>
//Added by qt3to4:
#include <QPixmap>
#include <QResizeEvent>
#include <QEvent>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QToolTip>
#include <QMenu>
#include <kaction.h>
#include <klocale.h>
......@@ -81,7 +75,7 @@ protected:
void showRoomContextMenu(void);
/** Used to display the context menu for other / no elements */
void showOtherContextMenu(void);
void showContextMenu(Q3PopupMenu *menu);
void showContextMenu(QMenu *menu);
/** Draw the map elements */
virtual void drawElements(QPainter *p);
......@@ -94,7 +88,7 @@ private:
/** Used to create the element context menus */
void initContexMenus(void);
/** This method is used to tell the plugins a menu is about to open then open the menu */
void popupMenu(CMapElement *element,Q3PopupMenu *menu,QPoint pos);
void popupMenu(CMapElement *element,QMenu *menu,QPoint pos);
friend class CMapView;
private:
QPoint selectedPos;
......@@ -108,10 +102,10 @@ private:
QCursor* mouseDragCursor;
// Menus
Q3PopupMenu *room_menu;
Q3PopupMenu *path_menu;
Q3PopupMenu *text_menu;
Q3PopupMenu *empty_menu;
QMenu *room_menu;
QMenu *path_menu;
QMenu *text_menu;
QMenu *empty_menu;
/** A pointer to the map manager */
CMapManager *mapManager;
......
......@@ -28,7 +28,6 @@
#include "../cmappropertiespanebase.h"
#include <qlineedit.h>
#include <q3multilineedit.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qpushbutton.h>
......
......@@ -18,17 +18,15 @@
#include "dlgmaptextproperties.h"
#include <qfile.h>
#include <q3listbox.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <q3multilineedit.h>
#include <q3textstream.h>
#include <qpalette.h>
#include <qfontdatabase.h>
#include <qtabwidget.h>
#include <qlayout.h>
#include <qfontmetrics.h>
#include <QScrollArea>
#include <QPixmap>
#include <QVBoxLayout>
......@@ -50,13 +48,10 @@
#include <kdebug.h>
CMapTextPreview::CMapTextPreview(CMapManager *manager,QWidget *parent)
: Q3ScrollView(parent, 0, Qt::WNorthWestGravity | Qt::WResizeNoErase | Qt::WRepaintNoErase)
: QWidget(parent, Qt::WNorthWestGravity | Qt::WResizeNoErase | Qt::WRepaintNoErase)
{
buffer = NULL;
mapManager = manager;
setHScrollBarMode(Auto);
setVScrollBarMode(Auto);
}
CMapTextPreview::~CMapTextPreview()
......@@ -67,19 +62,7 @@ CMapTextPreview::~CMapTextPreview()
void CMapTextPreview::drawContents(QPainter *paint,int , int , int, int )
{
int width,height;
if (contentsWidth()>viewport()->width())
width = contentsWidth();
else
width = viewport()->width();
if (contentsHeight()>viewport()->height())
height = contentsHeight();
else
height = viewport()->height();
QRect drawArea(0,0,width,height);
QRect drawArea(0,0,width(),height());
// delete the buffer only when we need one with a different size
if (buffer && (buffer->size() != drawArea.size()))
......@@ -124,7 +107,9 @@ DlgMapTextProperties::DlgMapTextProperties(CMapManager *manager,CMapText *textEl
QString height;
QVBoxLayout *vbox = new QVBoxLayout((QWidget *)fraPreview);
textScrollView = new CMapTextPreview(mapManager,fraPreview);
vbox->addWidget( textScrollView);
QScrollArea *textScrollArea = new QScrollArea (fraPreview);
textScrollArea->setWidget (textScrollView);
vbox->addWidget( textScrollArea);
textScrollView->show();
fillFamilyList();
setFont(text->getFont());
......@@ -263,6 +248,6 @@ void DlgMapTextProperties::slotUpdatePreview()
textScrollView->setColor(textColor);
textScrollView->setSize(QSize(width,height));
textScrollView->setText(txtText->text());
textScrollView->resizeContents(txtWidth->text().toInt(),txtHeight->text().toInt());
textScrollView->viewport()->update();
textScrollView->resize(txtWidth->text().toInt(),txtHeight->text().toInt());
textScrollView->update();
}
......@@ -21,14 +21,13 @@
#include <QDialog>
#include <qfont.h>
#include <qcolor.h>
#include <q3scrollview.h>
#include <qpixmap.h>
#include "ui_dlgmaptextpropertiesbase.h"
class CMapText;
class CMapManager;
class CMapTextPreview : public Q3ScrollView
class CMapTextPreview : public QWidget
{
public:
CMapTextPreview(CMapManager *manager,QWidget *parent=0);
......
......@@ -17,8 +17,8 @@
#include "dlgspeedwalkprogress.h"
#include <q3progressbar.h>
#include <qpushbutton.h>
#include <QProgressBar>
#include <QPushButton>
DlgSpeedwalkProgress::DlgSpeedwalkProgress(QWidget *parent) : QDialog(parent)
{
......@@ -31,17 +31,17 @@ DlgSpeedwalkProgress::~DlgSpeedwalkProgress()
void DlgSpeedwalkProgress::setProgress(int progress)
{
ProgressBar->setProgress(progress);
ProgressBar->setValue(progress);
}
int DlgSpeedwalkProgress::getTotalSteps(void)
{
return ProgressBar->totalSteps();
return ProgressBar->maximum();
}
void DlgSpeedwalkProgress::setTotalSteps(int steps)
{
ProgressBar->setTotalSteps(steps);
ProgressBar->setMaximum(steps);
}
void DlgSpeedwalkProgress::slotAbort()
......
......@@ -49,19 +49,13 @@
</widget>
</item>
<item>
<widget class="Q3ProgressBar" name="ProgressBar">
<widget class="QProgressBar" name="ProgressBar">
<property name="maximumSize">
<size>
<width>32767</width>
<height>15</height>
</size>
</property>
<property name="progress">
<number>100</number>
</property>
<property name="centerIndicator">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
......
......@@ -25,7 +25,6 @@
#include <qfile.h>
#include <qdom.h>
#include <qfileinfo.h>
#include <q3textstream.h>
#include <set>
......
......@@ -19,8 +19,7 @@
#define CMAPPLUGINSTANDARD_H
#include <QMap>
//Added by qt3to4:
#include <Q3ValueList>
#include <QLinkedList>
#include "../../cmappluginbase.h"
......@@ -104,7 +103,7 @@ private:
QString note;
};
typedef Q3ValueList<DeletedElement> DeletedElementList;
typedef QLinkedList<DeletedElement> DeletedElementList;
DeletedElementList::iterator findRoom(int level,int id,bool *found);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment