Changeset View
Changeset View
Standalone View
Standalone View
src/wrtembed/KReportDesignerSection.cpp
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Line(s) | 81 | public: | |||
---|---|---|---|---|---|
88 | KReportDesignerSectionTitle *title; | 88 | KReportDesignerSectionTitle *title; | ||
89 | KReportDesignerSectionScene *scene; | 89 | KReportDesignerSectionScene *scene; | ||
90 | ReportResizeBar *resizeBar; | 90 | ReportResizeBar *resizeBar; | ||
91 | KReportDesignerSectionView *sceneView; | 91 | KReportDesignerSectionView *sceneView; | ||
92 | KReportDesigner*reportDesigner; | 92 | KReportDesigner*reportDesigner; | ||
93 | KReportRuler *sectionRuler; | 93 | KReportRuler *sectionRuler; | ||
94 | 94 | | |||
95 | KReportSectionData *sectionData; | 95 | KReportSectionData *sectionData; | ||
96 | int dpiY; | 96 | int dpiY = 96; | ||
staniek: Not needed... all false positives please | |||||
staniek: Still, not needed, there's `d->dpiY = KReportPrivate::dpiY();` code below | |||||
97 | }; | 97 | }; | ||
98 | 98 | | |||
99 | 99 | | |||
100 | KReportDesignerSection::KReportDesignerSection(KReportDesigner * rptdes) | 100 | KReportDesignerSection::KReportDesignerSection(KReportDesigner * rptdes) | ||
101 | : QWidget(rptdes) | 101 | : QWidget(rptdes) | ||
102 | , d(new Private()) | 102 | , d(new Private()) | ||
103 | { | 103 | { | ||
104 | Q_ASSERT(rptdes); | 104 | Q_ASSERT(rptdes); | ||
▲ Show 20 Lines • Show All 279 Lines • ▼ Show 20 Line(s) | 381 | { | |||
384 | p.setCompositionMode(QPainter::CompositionMode_SourceIn); | 384 | p.setCompositionMode(QPainter::CompositionMode_SourceIn); | ||
385 | p.fillRect(dest.rect(), color); | 385 | p.fillRect(dest.rect(), color); | ||
386 | *original = QPixmap::fromImage(dest); | 386 | *original = QPixmap::fromImage(dest); | ||
387 | } | 387 | } | ||
388 | 388 | | |||
389 | void KReportDesignerSectionTitle::paintEvent(QPaintEvent * event) | 389 | void KReportDesignerSectionTitle::paintEvent(QPaintEvent * event) | ||
390 | { | 390 | { | ||
391 | QPainter painter(this); | 391 | QPainter painter(this); | ||
392 | KReportDesignerSection* _section = dynamic_cast<KReportDesignerSection*>(parent()); | 392 | KReportDesignerSection* section = dynamic_cast<KReportDesignerSection*>(parent()); | ||
393 | 393 | if (section) { | |||
394 | const bool current = _section->d->scene == _section->d->reportDesigner->activeScene(); | 394 | const bool current = section->d->scene == section->d->reportDesigner->activeScene(); | ||
395 | QPalette::ColorGroup cg = QPalette::Inactive; | 395 | QPalette::ColorGroup cg = QPalette::Inactive; | ||
396 | QWidget *activeWindow = QApplication::activeWindow(); | 396 | QWidget *activeWindow = QApplication::activeWindow(); | ||
397 | if (activeWindow) { | 397 | if (activeWindow) { | ||
398 | QWidget *par = activeWindow->focusWidget(); | 398 | QWidget *par = activeWindow->focusWidget(); | ||
399 | if (qobject_cast<KReportDesignerSectionView*>(par)) { | 399 | if (qobject_cast<KReportDesignerSectionView*>(par)) { | ||
400 | par = par->parentWidget(); // we're close, pick common parent | 400 | par = par->parentWidget(); // we're close, pick common parent | ||
401 | } | 401 | } | ||
402 | if (hasParent(par, this)) { | 402 | if (hasParent(par, this)) { | ||
403 | cg = QPalette::Active; | 403 | cg = QPalette::Active; | ||
404 | } | 404 | } | ||
staniek: Can we skip _? | |||||
405 | } | 405 | } | ||
406 | if (current) { | 406 | if (current) { | ||
407 | painter.fillRect(rect(), palette().brush(cg, QPalette::Highlight)); | 407 | painter.fillRect(rect(), palette().brush(cg, QPalette::Highlight)); | ||
408 | } | 408 | } | ||
409 | painter.setPen(palette().color(cg, current ? QPalette::HighlightedText : QPalette::WindowText)); | 409 | painter.setPen(palette().color(cg, current ? QPalette::HighlightedText : QPalette::WindowText)); | ||
410 | QPixmap pixmap(QIcon::fromTheme(QLatin1String("arrow-down")).pixmap(16,16)); | 410 | QPixmap pixmap(QIcon::fromTheme(QLatin1String("arrow-down")).pixmap(16,16)); | ||
411 | replaceColors(&pixmap, painter.pen().color()); | 411 | replaceColors(&pixmap, painter.pen().color()); | ||
412 | const int left = 25; | 412 | const int left = 25; | ||
413 | painter.drawPixmap(QPoint(left, (height() - pixmap.height()) / 2), pixmap); | 413 | painter.drawPixmap(QPoint(left, (height() - pixmap.height()) / 2), pixmap); | ||
414 | 414 | | |||
415 | painter.drawText(rect().adjusted(left + pixmap.width() + 4, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, text()); | 415 | painter.drawText(rect().adjusted(left + pixmap.width() + 4, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, text()); | ||
416 | } | ||||
416 | QFrame::paintEvent(event); | 417 | QFrame::paintEvent(event); | ||
417 | } | 418 | } | ||
418 | 419 | | |||
419 | void KReportDesignerSectionTitle::mousePressEvent(QMouseEvent *event) | 420 | void KReportDesignerSectionTitle::mousePressEvent(QMouseEvent *event) | ||
420 | { | 421 | { | ||
421 | QLabel::mousePressEvent(event); | 422 | QLabel::mousePressEvent(event); | ||
422 | if (event->button() == Qt::LeftButton) { | 423 | if (event->button() == Qt::LeftButton) { | ||
423 | emit clicked(); | 424 | emit clicked(); | ||
424 | } | 425 | } | ||
425 | } | 426 | } | ||
426 | 427 | | |||
427 | #include "KReportDesignerSection.moc" | 428 | #include "KReportDesignerSection.moc" |
Not needed... all false positives please