MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / configure

Method configure

src/common/tooltip/tips.cpp:45–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void TextTip::configure(const QPoint &pos)
46{
47 setText(tipText);
48
49 QFontMetrics fm(font());
50 int extraHeight = 0;
51 if (fm.descent() == 2 && fm.ascent() >= 11)
52 ++extraHeight;
53
54 setWordWrap(false);
55 int tipWidth = sizeHint().width();
56
57 QScreen *screen = QGuiApplication::screenAt(pos);
58 if (!screen)
59 screen = QGuiApplication::primaryScreen();
60
61 const int screenWidth = screen->availableGeometry().width();
62 const int maxDesiredWidth = int(screenWidth * .5);
63 if (tipWidth > maxDesiredWidth) {
64 setWordWrap(true);
65 tipWidth = maxDesiredWidth;
66 }
67
68 resize(tipWidth, heightForWidth(tipWidth) + extraHeight);
69}
70
71bool TextTip::canHandleContentReplacement(ContentType type) const
72{

Callers 1

setUpMethod · 0.45

Calls 4

fontFunction · 0.85
widthMethod · 0.80
countMethod · 0.45
addWidgetMethod · 0.45

Tested by

no test coverage detected