summaryrefslogtreecommitdiffstats
path: root/src/qalculateresultdisplay.cpp
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2016-04-09 20:52:09 +0200
committerSlávek Banko <[email protected]>2016-04-09 20:52:09 +0200
commit91d2d7482c36e67cb36df9d1dcdbd989911e4ceb (patch)
treec842adfbb1a172d9b61241d7dde70354e821bb75 /src/qalculateresultdisplay.cpp
parent4870c0c8c53d3df6ba954b2b4d8ebd87a8c43060 (diff)
downloadqalculate-tde-91d2d7482c36e67cb36df9d1dcdbd989911e4ceb.tar.gz
qalculate-tde-91d2d7482c36e67cb36df9d1dcdbd989911e4ceb.zip
Initial TQt conversion
Signed-off-by: Slávek Banko <[email protected]>
Diffstat (limited to 'src/qalculateresultdisplay.cpp')
-rw-r--r--src/qalculateresultdisplay.cpp124
1 files changed, 62 insertions, 62 deletions
diff --git a/src/qalculateresultdisplay.cpp b/src/qalculateresultdisplay.cpp
index 2472430..39cafef 100644
--- a/src/qalculateresultdisplay.cpp
+++ b/src/qalculateresultdisplay.cpp
@@ -26,22 +26,22 @@
#include <kxmlguiclient.h>
#include <kaction.h>
#include <kmessagebox.h>
-#include <qwhatsthis.h>
-#include <qtooltip.h>
+#include <tqwhatsthis.h>
+#include <tqtooltip.h>
#include <klocale.h>
#include <kapplication.h>
-#include <qsimplerichtext.h>
+#include <tqsimplerichtext.h>
extern vector<mode_struct> modes;
-extern QString parsed_text;
+extern TQString parsed_text;
extern KQalculate *mainWin;
extern MathStructure *mstruct;
extern PrintOptions printops;
extern EvaluationOptions evalops;
-QString linkInfo(const MathStructure *m, QWidget *w, bool full_length = false) {
- QString str;
+TQString linkInfo(const MathStructure *m, TQWidget *w, bool full_length = false) {
+ TQString str;
if(m) {
if(m->isSymbolic()) {
str = "\"";
@@ -71,18 +71,18 @@ QString linkInfo(const MathStructure *m, QWidget *w, bool full_length = false) {
str += "\n";
str += i18n("Prefix");
str += ": ";
- QString pstr;
+ TQString pstr;
switch(m->prefix()->type()) {
case PREFIX_DECIMAL: {
- QTextOStream(&pstr) << m->prefix()->name(false, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) w).c_str() << " (10e" << ((DecimalPrefix*) m->prefix())->exponent() << ")";
+ TQTextOStream(&pstr) << m->prefix()->name(false, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) w).c_str() << " (10e" << ((DecimalPrefix*) m->prefix())->exponent() << ")";
break;
}
case PREFIX_BINARY: {
- QTextOStream(&pstr) << m->prefix()->name(false, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) w).c_str() << " (2e" << ((BinaryPrefix*) m->prefix())->exponent() << ")";
+ TQTextOStream(&pstr) << m->prefix()->name(false, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) w).c_str() << " (2e" << ((BinaryPrefix*) m->prefix())->exponent() << ")";
break;
}
case PREFIX_NUMBER: {
- QTextOStream(&pstr) << m->prefix()->name(false, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) w).c_str();
+ TQTextOStream(&pstr) << m->prefix()->name(false, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) w).c_str();
break;
}
}
@@ -119,7 +119,7 @@ QString linkInfo(const MathStructure *m, QWidget *w, bool full_length = false) {
} else {
str += i18n("argument");
str += " ";
- str += QString::number(i2);
+ str += TQString::number(i2);
}
if(i2 > f->minargs()) {
str += "]";
@@ -144,7 +144,7 @@ QString linkInfo(const MathStructure *m, QWidget *w, bool full_length = false) {
if(f->subtype() == SUBTYPE_DATA_SET) {
str += "<br>";
str += "<br>";
- QString str2;
+ TQString str2;
str2.sprintf(i18n("Retrieves data from the %s data set for a given object and property. If \"info\" is typed as property, a dialog window will pop up with all properties of the object."), f->title().c_str());
str2.replace("<", "&lt;");
str2.replace(">", "&gt;");
@@ -153,7 +153,7 @@ QString linkInfo(const MathStructure *m, QWidget *w, bool full_length = false) {
if(!f->description().empty()) {
str += "<br>";
str += "<br>";
- QString str2 = f->description().c_str();
+ TQString str2 = f->description().c_str();
str2.replace("<", "&lt;");
str2.replace(">", "&gt;");
str += str2;
@@ -165,9 +165,9 @@ QString linkInfo(const MathStructure *m, QWidget *w, bool full_length = false) {
}
-QString linkInfo(const QString &link, QWidget *w, bool full_length = false) {
+TQString linkInfo(const TQString &link, TQWidget *w, bool full_length = false) {
if(!link.isEmpty() && link[0] == '+') {
- QString str = link;
+ TQString str = link;
str.remove(0, 1);
return str;
} else {
@@ -175,68 +175,68 @@ QString linkInfo(const QString &link, QWidget *w, bool full_length = false) {
}
}
-class QalculateExpressionToolTip : public QToolTip {
+class QalculateExpressionToolTip : public TQToolTip {
public:
QalculateResultDisplay *qrd;
- QalculateExpressionToolTip(QalculateResultDisplay *parent, QToolTipGroup *group = 0) : QToolTip(parent->viewport(), group) {
+ QalculateExpressionToolTip(QalculateResultDisplay *parent, TQToolTipGroup *group = 0) : TQToolTip(parent->viewport(), group) {
qrd = parent;
}
virtual ~QalculateExpressionToolTip() {}
protected:
- void maybeTip(const QPoint &p) {
+ void maybeTip(const TQPoint &p) {
int cx = qrd->contentsX();
int cy = qrd->contentsY();
- QString str = qrd->anchorAt(qrd->viewportToContents(p), Qt::AnchorName);
+ TQString str = qrd->anchorAt(qrd->viewportToContents(p), TQt::AnchorName);
if(str.isEmpty()) return;
int w = 5;
- while(p.x() + w < qrd->visibleWidth() && qrd->anchorAt(QPoint(p.x() + cx + w, p.y() + cy), Qt::AnchorName) == str) {
+ while(p.x() + w < qrd->visibleWidth() && qrd->anchorAt(TQPoint(p.x() + cx + w, p.y() + cy), TQt::AnchorName) == str) {
w += 5;
}
int x = p.x() - 5;
w += 5;
- while(x > 0 && qrd->anchorAt(QPoint(x + cx, p.y() + cy), Qt::AnchorName) == str) {
+ while(x > 0 && qrd->anchorAt(TQPoint(x + cx, p.y() + cy), TQt::AnchorName) == str) {
x -= 5;
w += 5;
}
if(x < 0) x = 0;
if(w + x > qrd->visibleWidth()) w = qrd->visibleWidth() - x;
int h = 5;
- while(p.y() + h < qrd->visibleHeight() && qrd->anchorAt(QPoint(p.x() + cx, p.y() + cy + h), Qt::AnchorName) == str) {
+ while(p.y() + h < qrd->visibleHeight() && qrd->anchorAt(TQPoint(p.x() + cx, p.y() + cy + h), TQt::AnchorName) == str) {
h += 5;
}
int y = p.y() - 5;
h += 5;
- while(y > 0 && qrd->anchorAt(QPoint(p.x() + cx, y + cy), Qt::AnchorName) == str) {
+ while(y > 0 && qrd->anchorAt(TQPoint(p.x() + cx, y + cy), TQt::AnchorName) == str) {
y -= 5;
h += 5;
}
if(y < 0) y = 0;
if(h + y > qrd->visibleHeight()) h = qrd->visibleHeight() - y;
- tip(QRect(x, y, w, h), linkInfo(str, qrd, true));
+ tip(TQRect(x, y, w, h), linkInfo(str, qrd, true));
}
};
-QalculateResultDisplay::QalculateResultDisplay(QWidget *parent, const char *name): QTextBrowser(parent, name) {
+QalculateResultDisplay::QalculateResultDisplay(TQWidget *parent, const char *name): TQTextBrowser(parent, name) {
setResizePolicy(AutoOneFit);
setVScrollBarMode(Auto);
setHScrollBarMode(Auto);
- setTextFormat(Qt::RichText);
- setFrameStyle(QFrame::NoFrame);
- //setFocusPolicy(QWidget::TabFocus);
+ setTextFormat(TQt::RichText);
+ setFrameStyle(TQFrame::NoFrame);
+ //setFocusPolicy(TQWidget::TabFocus);
paletteChanged();
m_under_pointer = NULL;
- QToolTipGroup *tgroup = new QToolTipGroup(viewport());
+ TQToolTipGroup *tgroup = new TQToolTipGroup(viewport());
tooltip = new QalculateExpressionToolTip(this, tgroup);
- //connect(this, SIGNAL(anchorClicked(const QString&, const QString&)), this, SLOT(onAnchorClicked(const QString&, const QString&)));
+ //connect(this, SIGNAL(anchorClicked(const TQString&, const TQString&)), this, SLOT(onAnchorClicked(const TQString&, const TQString&)));
connect(this, SIGNAL(doubleClicked(int, int)), this, SLOT(onDoubleClicked(int, int)));
if(kapp) {
connect(kapp, SIGNAL(kdisplayPaletteChanged()), this, SLOT(paletteChanged()));
@@ -250,16 +250,16 @@ void QalculateResultDisplay::setRightMargin(int i_margin) {
setMargins(0, 0, i_margin, 0);
}
-void QalculateResultDisplay::onAnchorClicked(const QString&, const QString&) {
+void QalculateResultDisplay::onAnchorClicked(const TQString&, const TQString&) {
/*if(name.isEmpty()) return;
- QWhatsThis::display(linkInfo(name, this, true));*/
+ TQWhatsThis::display(linkInfo(name, this, true));*/
}
-QPopupMenu *QalculateResultDisplay::createPopupMenu(const QPoint &pos) {
+TQPopupMenu *QalculateResultDisplay::createPopupMenu(const TQPoint &pos) {
m_under_pointer = NULL;
- QPopupMenu *menu = QTextBrowser::createPopupMenu(pos);
+ TQPopupMenu *menu = TQTextBrowser::createPopupMenu(pos);
menu->insertSeparator();
mainWin->ActionStoreResult->plug(menu);
mainWin->ActionSaveAsImage->plug(menu);
@@ -322,8 +322,8 @@ QPopupMenu *QalculateResultDisplay::createPopupMenu(const QPoint &pos) {
mainWin->ActionEnableDenominatorPrefixes->plug(menu);
}
menu->insertSeparator();
- QPopupMenu *modes_menu = new QPopupMenu(menu);
- QObject::connect(modes_menu, SIGNAL(activated(int)), mainWin, SLOT(loadMode(int)));
+ TQPopupMenu *modes_menu = new TQPopupMenu(menu);
+ TQObject::connect(modes_menu, SIGNAL(activated(int)), mainWin, SLOT(loadMode(int)));
for(size_t i = 0; i < modes.size(); i++) {
modes_menu->insertItem(modes[i].name, i, i);
}
@@ -334,7 +334,7 @@ QPopupMenu *QalculateResultDisplay::createPopupMenu(const QPoint &pos) {
if(parsed_text.isEmpty()) return menu;
menu->insertSeparator();
menu->insertItem(i18n("Show Parsed Expression"), this, SLOT(showParsedExpression()));
- QString str = anchorAt(pos, Qt::AnchorName);
+ TQString str = anchorAt(pos, TQt::AnchorName);
if(!str.isEmpty()) {
if(str[0] == '+') {
name_under_pointer = str;
@@ -379,16 +379,16 @@ void QalculateResultDisplay::displayScientific() {
}
void QalculateResultDisplay::showParsedExpression() {
- QString str = i18n("Parsed expression:");
+ TQString str = i18n("Parsed expression:");
str += "\n";
str += parsed_text;
- QWhatsThis::display(str, curpos);
+ TQWhatsThis::display(str, curpos);
}
void QalculateResultDisplay::showInfo() {
if(m_under_pointer) {
- QWhatsThis::display(linkInfo(m_under_pointer, this, true), curpos);
+ TQWhatsThis::display(linkInfo(m_under_pointer, this, true), curpos);
} else {
- QWhatsThis::display(linkInfo(name_under_pointer, this, true), curpos);
+ TQWhatsThis::display(linkInfo(name_under_pointer, this, true), curpos);
}
}
void QalculateResultDisplay::editVector() {
@@ -399,30 +399,30 @@ void QalculateResultDisplay::editMatrix() {
}
void QalculateResultDisplay::paletteChanged() {
- QPalette p = kapp ? kapp->palette() : palette();
- p.setBrush(QColorGroup::Base, p.brush(QPalette::Normal, QColorGroup::Background));
- p.setColor(QColorGroup::Text, p.color(QPalette::Normal, QColorGroup::Foreground));
+ TQPalette p = kapp ? kapp->palette() : palette();
+ p.setBrush(TQColorGroup::Base, p.brush(TQPalette::Normal, TQColorGroup::Background));
+ p.setColor(TQColorGroup::Text, p.color(TQPalette::Normal, TQColorGroup::Foreground));
setPalette(p);
}
void QalculateResultDisplay::virtual_hook(int, void*) {
}
-void QalculateResultDisplay::focusInEvent(QFocusEvent* fe) {
- QTextBrowser::focusInEvent(fe);
- if(fe->reason() == QFocusEvent::Tab || fe->reason() == QFocusEvent::Backtab)
+void QalculateResultDisplay::focusInEvent(TQFocusEvent* fe) {
+ TQTextBrowser::focusInEvent(fe);
+ if(fe->reason() == TQFocusEvent::Tab || fe->reason() == TQFocusEvent::Backtab)
selectAll(true);
}
-void QalculateResultDisplay::focusOutEvent(QFocusEvent* fe) {
- QTextBrowser::focusOutEvent(fe);
- if(fe->reason() == QFocusEvent::Tab || fe->reason() == QFocusEvent::Backtab)
+void QalculateResultDisplay::focusOutEvent(TQFocusEvent* fe) {
+ TQTextBrowser::focusOutEvent(fe);
+ if(fe->reason() == TQFocusEvent::Tab || fe->reason() == TQFocusEvent::Backtab)
selectAll(false);
}
void QalculateResultDisplay::onDoubleClicked(int, int) {
- curpos = QCursor::pos();
- QString str = anchorAt(viewportToContents(viewport()->mapFromGlobal(curpos)), Qt::AnchorName);
+ curpos = TQCursor::pos();
+ TQString str = anchorAt(viewportToContents(viewport()->mapFromGlobal(curpos)), TQt::AnchorName);
if(!str.isEmpty()) {
if(str[0] == '+') {
selectAll(false);
@@ -447,26 +447,26 @@ void QalculateResultDisplay::onDoubleClicked(int, int) {
}
}
-void QalculateResultDisplay::keyPressEvent(QKeyEvent *e) {
+void QalculateResultDisplay::keyPressEvent(TQKeyEvent *e) {
switch (e->key()) {
case Key_Down:
case Key_Up:
case Key_Left:
case Key_Right:
- // jump over QTextEdit's key navigation breakage.
+ // jump over TQTextEdit's key navigation breakage.
// we're not interested in keyboard navigation within the text
- QWidget::keyPressEvent(e);
+ TQWidget::keyPressEvent(e);
break;
default:
- QTextBrowser::keyPressEvent(e);
+ TQTextBrowser::keyPressEvent(e);
}
}
-QSize QalculateResultDisplay::minimumSizeHint() const {
+TQSize QalculateResultDisplay::minimumSizeHint() const {
- QSize ms = minimumSize();
+ TQSize ms = minimumSize();
if((ms.width() > 0) && (ms.height() > 0))
return ms;
@@ -474,9 +474,9 @@ QSize QalculateResultDisplay::minimumSizeHint() const {
if(ms.width() > 0)
w = ms.width();
- QSimpleRichText rt("<font size=6>X</font>", font());
+ TQSimpleRichText rt("<font size=6>X</font>", font());
rt.setWidth(100);
- QSimpleRichText rt2("<font size=2>X</font>", font());
+ TQSimpleRichText rt2("<font size=2>X</font>", font());
rt2.setWidth(100);
int h2 = (int) (rt2.height() / 1.5);
h2 += h2 % 2;
@@ -484,10 +484,10 @@ QSize QalculateResultDisplay::minimumSizeHint() const {
if(h < ms.height())
h = ms.height();
- return QSize(w, h);
+ return TQSize(w, h);
}
-QSize QalculateResultDisplay::sizeHint() const {
+TQSize QalculateResultDisplay::sizeHint() const {
return minimumSizeHint();
}