@@ -574,44 +574,6 @@ void InstanceView::paintEvent([[maybe_unused]] QPaintEvent* event)
574574 option.widget = this ;
575575
576576 if (model ()->rowCount () == 0 ) {
577- painter.save ();
578- QString emptyString = tr (" Welcome!" ) + " \n " + tr (" Click \" Add Instance\" to get started." );
579-
580- // calculate the rect for the overlay
581- painter.setRenderHint (QPainter::Antialiasing, true );
582- QFont font (" sans" , 20 );
583- font.setBold (true );
584-
585- QRect bounds = viewport ()->geometry ();
586- bounds.moveTop (0 );
587- auto innerBounds = bounds;
588- innerBounds.adjust (10 , 10 , -10 , -10 );
589-
590- QColor background = QApplication::palette ().color (QPalette::WindowText);
591- QColor foreground = QApplication::palette ().color (QPalette::Base);
592- foreground.setAlpha (190 );
593- painter.setFont (font);
594- auto fontMetrics = painter.fontMetrics ();
595- auto textRect = fontMetrics.boundingRect (innerBounds, Qt::AlignHCenter | Qt::TextWordWrap, emptyString);
596- textRect.moveCenter (bounds.center ());
597-
598- auto wrapRect = textRect;
599- wrapRect.adjust (-10 , -10 , 10 , 10 );
600-
601- // check if we are allowed to draw in our area
602- if (!event->rect ().intersects (wrapRect)) {
603- return ;
604- }
605-
606- painter.setBrush (QBrush (background));
607- painter.setPen (foreground);
608- painter.drawRoundedRect (wrapRect, 5.0 , 5.0 );
609-
610- painter.setPen (foreground);
611- painter.setFont (font);
612- painter.drawText (textRect, Qt::AlignHCenter | Qt::TextWordWrap, emptyString);
613-
614- painter.restore ();
615577 return ;
616578 }
617579
0 commit comments