Merge pull request 'dpi-dependent methods' (#16) from dpi into master
Reviewed-on: https://git.shs.tools/SHS/qad/pulls/16
This commit was merged in pull request #16.
This commit is contained in:
@@ -91,7 +91,7 @@ void BlockView::_init() {
|
||||
sel_rect.hide();
|
||||
QColor sc = palette().color(QPalette::Highlight);
|
||||
sc.setAlphaF(0.6);
|
||||
QPen pen(sc.darker(200), lineThickness() + 1., Qt::DotLine);
|
||||
QPen pen(sc.darker(200), lineThickness(this) + 1., Qt::DotLine);
|
||||
pen.setCosmetic(true);
|
||||
sel_rect.setPen(pen);
|
||||
sc.setAlphaF(0.2);
|
||||
@@ -791,7 +791,7 @@ void BlockView::keyReleaseEvent(QKeyEvent * e) {
|
||||
|
||||
void BlockView::resizeEvent(QResizeEvent * event) {
|
||||
QGraphicsView::resizeEvent(event);
|
||||
thick = lineThickness();
|
||||
thick = lineThickness(this);
|
||||
adjustThumb();
|
||||
updateNavRect();
|
||||
nav_target = _nav();
|
||||
|
||||
@@ -235,8 +235,8 @@ actions_Z_up(this), actions_Z_top(this), actions_Z_down(this), actions_Z_bottom(
|
||||
ui->labelBrush->setMinimumSize(ui->labelPen->minimumSize());
|
||||
ui->labelBrush->setMaximumSize(ui->labelBrush->minimumSize());
|
||||
widget_props->setEnabled(false);
|
||||
int fh = qMax<int>(fontHeight(), 22);
|
||||
int thick = lineThickness();
|
||||
int fh = qMax<int>(fontHeight(this), 22);
|
||||
int thick = lineThickness(this);
|
||||
QSize sz(fh * 2.5, fh);
|
||||
ui->comboLineStyle->setIconSize(sz);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
|
||||
@@ -126,7 +126,7 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this),
|
||||
gridx = gridy = 1.;
|
||||
history = 5.;
|
||||
visible_time = -1.;
|
||||
thick = lineThickness();
|
||||
thick = lineThickness(this);
|
||||
pause_phase = 0.;
|
||||
def_rect.setRect(0., 0., 1., 1.);
|
||||
selrect = def_rect;
|
||||
@@ -320,7 +320,7 @@ void Graphic::canvasPaintEvent() {
|
||||
#else
|
||||
font_sz.setWidth(font_sz.width() * 8);
|
||||
#endif
|
||||
thick = lineThickness();
|
||||
thick = lineThickness(this);
|
||||
if (buffer != 0) if (buffer->width() != wid || buffer->height() != hei) {delete buffer; buffer = 0;}
|
||||
if (buffer == 0) buffer = new QImage(wid, hei, QImage::Format_RGB32);
|
||||
if (bufferActive) {
|
||||
|
||||
@@ -8,7 +8,7 @@ GraphicConf::GraphicConf(QVector<GraphicType> & graphics_, QWidget * parent): QD
|
||||
ui->setupUi(this);
|
||||
QStringList styles;
|
||||
int fh = qMax<int>(fontMetrics().size(0, "0").height(), 22);
|
||||
int thick = lineThickness();
|
||||
int thick = lineThickness(this);
|
||||
QSize sz(fh * 2.5, fh);
|
||||
styles << tr("NoPen") << tr("Solid") << tr("Dash")
|
||||
<< tr("Dot") << tr("Dash-Dot") << tr("Dash-Dot-Dot");
|
||||
|
||||
@@ -344,7 +344,7 @@ SQLTableWidget::SQLTableWidget(QWidget * parent): QWidget(parent), filters_group
|
||||
ui->view->horizontalHeader()->viewport()->installEventFilter(this);
|
||||
ui->view->setItemDelegate(new SQLItemDelegate(column_props, column_indexes, read_only, connection_name));
|
||||
ui->view->horizontalHeader()->setItemDelegate(new QItemDelegate());
|
||||
ui->view->verticalHeader()->setDefaultSectionSize(fontHeight() * 1.5);
|
||||
ui->view->verticalHeader()->setDefaultSectionSize(fontHeight(this) * 1.5);
|
||||
//qDebug() << view->horizontalHeader()->itemDelegate();
|
||||
//qDebug() << fontMetrics().elidedText(, Qt::ElideNone, 30, Qt::TextWordWrap);
|
||||
setTableVisible(false);
|
||||
|
||||
@@ -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