dpi-dependent methods
This commit is contained in:
@@ -10,7 +10,7 @@ CLineEdit::CLineEdit(QWidget * parent): QLineEdit(parent) {
|
||||
cw->hide();
|
||||
cw->installEventFilter(this);
|
||||
connect(this, SIGNAL(textChanged(QString)), this, SLOT(textChanged_(QString)));
|
||||
int is = fontHeight();
|
||||
int is = fontHeight(this);
|
||||
QMargins m = textMargins();
|
||||
m.setRight(m.right() + (is * 1.2));
|
||||
setTextMargins(m);
|
||||
@@ -33,7 +33,7 @@ bool CLineEdit::eventFilter(QObject * o, QEvent * e) {
|
||||
|
||||
void CLineEdit::resizeEvent(QResizeEvent * e) {
|
||||
QLineEdit::resizeEvent(e);
|
||||
int is = fontHeight(), tm = (height() - is) / 2;
|
||||
int is = fontHeight(this), tm = (height() - is) / 2;
|
||||
cw->setGeometry(width() - is - tm, tm, is, is);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ bool EvalSpinBox::eventFilter(QObject * o, QEvent * e) {
|
||||
|
||||
|
||||
void EvalSpinBox::resizeIcons() {
|
||||
int is = fontHeight();
|
||||
int is = fontHeight(this);
|
||||
int tm = (lineEdit()->height() - is + 1) / 2;
|
||||
QStyleOptionFrame so;
|
||||
so.initFrom(lineEdit());
|
||||
|
||||
@@ -85,7 +85,7 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
|
||||
help_visible = true;
|
||||
completer = new QCodeEditCompleter();
|
||||
|
||||
cursor_width = qMax<int>(qRound(fontHeight() / 10.), 1);
|
||||
cursor_width = qMax<int>(qRound(fontHeight(this) / 10.), 1);
|
||||
ui->textCode->setCursorWidth(0);
|
||||
ui->textCode->viewport()->setMouseTracking(true);
|
||||
ui->textLines->viewport()->setAutoFillBackground(false);
|
||||
@@ -202,7 +202,7 @@ void QCodeEdit::setDocument(QTextDocument * doc) {
|
||||
if (!qobject_cast<QPlainTextDocumentLayout*>(doc->documentLayout()))
|
||||
doc->setDocumentLayout(new QPlainTextDocumentLayout(doc));
|
||||
ui->textCode->setDocument(doc);
|
||||
cursor_width = qMax<int>(qRound(fontHeight() / 10.), 1);
|
||||
cursor_width = qMax<int>(qRound(fontHeight(this) / 10.), 1);
|
||||
ui->textCode->setCursorWidth(0);
|
||||
//ui->textCode->setCursorWidth(qMax<int>(qRound(fontHeight() / 10.), 1));
|
||||
setShowSpaces(spaces_);
|
||||
@@ -1576,7 +1576,7 @@ void QCodeEdit::raiseHelp(QTextCursor tc, int arg) {
|
||||
#endif
|
||||
QPoint whp;
|
||||
whp.setX(whr.left() - whr.width() - (widget_help->width() - whr.width()) / 2);
|
||||
whp.setY(whr.top() - widget_help->height() - (fontHeight() / 3));
|
||||
whp.setY(whr.top() - widget_help->height() - (fontHeight(this) / 3));
|
||||
//qDebug() << whr << whp << widget_help->width() << ", " << st;
|
||||
widget_help->move(ui->textCode->viewport()->mapToGlobal(whp));
|
||||
widget_help->show();
|
||||
|
||||
@@ -120,5 +120,5 @@ void QCodeEditCompleter::keyPressEvent(QKeyEvent * e) {
|
||||
|
||||
void QCodeEditCompleter::adjust() {
|
||||
int sz = sizeHint().width();
|
||||
resize(sz, fontHeight() * 16);
|
||||
resize(sz, fontHeight(this) * 16);
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ RangeSlider::RangeSlider(Qt::Orientation ori, Mode m, QWidget * parent)
|
||||
|
||||
void RangeSlider::init() {
|
||||
setMouseTracking(true);
|
||||
scHandleSideLength = 16*lineThickness();
|
||||
scSliderBarHeight = 8*lineThickness();
|
||||
scLeftRightMargin = 2*lineThickness();
|
||||
scHandleSideLength = 16*lineThickness(this);
|
||||
scSliderBarHeight = 8*lineThickness(this);
|
||||
scLeftRightMargin = 2*lineThickness(this);
|
||||
}
|
||||
|
||||
void RangeSlider::paintEvent(QPaintEvent *) {
|
||||
|
||||
Reference in New Issue
Block a user