Changeset View
Changeset View
Standalone View
Standalone View
language/duchain/navigation/abstractnavigationwidget.cpp
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Line(s) | |||||
139 | void AbstractNavigationWidget::update() { | 139 | void AbstractNavigationWidget::update() { | ||
140 | setUpdatesEnabled(false); | 140 | setUpdatesEnabled(false); | ||
141 | Q_ASSERT( m_context ); | 141 | Q_ASSERT( m_context ); | ||
142 | 142 | | |||
143 | QString html = m_context->html(); | 143 | QString html = m_context->html(); | ||
144 | if(!html.isEmpty()) { | 144 | if(!html.isEmpty()) { | ||
145 | int scrollPos = m_browser->verticalScrollBar()->value(); | 145 | int scrollPos = m_browser->verticalScrollBar()->value(); | ||
146 | 146 | | |||
147 | // TODO: Only show that the first time, or the first few times this context is shown? | ||||
148 | html += QStringLiteral("<p><small>"); | ||||
149 | if (m_context->linkCount() > 0) { | ||||
150 | html += i18n("(Hold 'Alt' to show. Navigate via arrow keys, activate by pressing 'Enter')"); | ||||
151 | } else { | ||||
152 | html += i18n("(Hold 'Alt' to show this tooltip)"); | ||||
153 | } | ||||
154 | html += QStringLiteral("</small></p>"); | ||||
155 | | ||||
147 | m_browser->setHtml( html ); | 156 | m_browser->setHtml( html ); | ||
148 | 157 | | |||
149 | m_currentText = html; | 158 | m_currentText = html; | ||
159 | | ||||
150 | m_idealTextSize = QSize(); | 160 | m_idealTextSize = QSize(); | ||
151 | 161 | | |||
152 | QSize hint = sizeHint(); | 162 | QSize hint = sizeHint(); | ||
153 | if(hint.height() >= m_idealTextSize.height()) { | 163 | if(hint.height() >= m_idealTextSize.height()) { | ||
154 | m_browser->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | 164 | m_browser->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | ||
155 | }else{ | 165 | }else{ | ||
156 | m_browser->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); | 166 | m_browser->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); | ||
157 | } | 167 | } | ||
▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines |