KviIOGraphWidget::KviIOGraphWidget(QWidget * par) : QWidget(par) { m_uLastSentBytes = g_uOutgoingTraffic; m_uLastRecvBytes = g_uIncomingTraffic; m_maxRate = 1; unsigned int iMax = qMax(m_uLastSentBytes, m_uLastRecvBytes); while(iMax > m_maxRate) m_maxRate *= 2; m_sendRates.prepend(0); m_recvRates.prepend(0); QString tip("<font color=\"#FF0000\">"); tip.append(__tr("Outgoing traffic")); tip.append("</font><br/><font color=\"#0000FF\">"); tip.append(__tr("Incoming traffic")); tip.append("</font>"); this->setToolTip(tip); startTimer(1000); }
void WTextCreator::start() { WGraphicsLayer* layer = scene()->addLayer(WCreatorSettings::instance().layer()); layer->setEditable(true); scene()->setCurrentLayer(layer); emit tip("press left button to select text's start point or press right button to cancel"); }
QString LiveTemplate::generateTip() const { static const QLatin1Char kNewLine('\n'); static const QLatin1Char kSpace(' '); static const QLatin1String kBr("<br>"); static const QLatin1String kNbsp(" "); static const QLatin1String kNoBr("<nobr>"); static const QLatin1String kOpenBold("<b>"); static const QLatin1String kCloseBold("</b>"); static const QLatin1String kEllipsis("..."); QString escapedContent(_content.toHtmlEscaped()); escapedContent.replace(kNewLine, kBr); escapedContent.replace(kSpace, kNbsp); QString tip(kNoBr); int count = 0; for (int i = 0; i < escapedContent.count(); ++i) { if (escapedContent.at(i) != kVariableDelimiter) { tip += escapedContent.at(i); continue; } if (++count % 2) { tip += kOpenBold; } else { if (escapedContent.at(i-1) == kVariableDelimiter) tip += kEllipsis; tip += kCloseBold; } } return tip; }
void WEllipseCreator::mousePressEvent(WGraphicsSceneMouseEvent* event) { if (event->button() == Ws::RightButton) { if (_item) { scene()->currentLayer()->removeItem(_item, true); scene()->currentLayer()->removeItem(_helperItem, true); } emit finished(0); clear(); } else if (event->button() == Ws::LeftButton) { WWorldPointF pos = event->scenePos(); if (_step == 0) { WWorldRectF rect(pos.x()-20, pos.y(), 20, 20); const WCreatorSettings& settings = WCreatorSettings::instance(); _item = scene()->currentLayer()->addEllipse(rect, settings.pen(), settings.brush(), true); _helperItem = scene()->currentLayer()->addRect(rect, 0.0, WPen(Ws::DashDotDotLine, WColor(0, 0, 255), 1.0), WBrush(), true); emit geometry(cell_format(*_item)); emit tip("move mouse and release left button to select rectangle's bottom right point or press right button to cancel"); ++_step; } } }
void HomeScreenController::goToTip(int index) { static QStringList tips; if (tips.isEmpty()) { // Normally, this will be read only once. QFile file(QString::fromLatin1(":/help/tip-of-the-day/tips.txt")); if (file.open(QIODevice::ReadOnly)) { while (!file.atEnd()) { QString tip(QString::fromUtf8(file.readLine().constData())); if (tip.endsWith(QLatin1Char('\n'))) tip.chop(1); if (!tip.isEmpty()) tips.push_back(tip); } } } if (tips.isEmpty()) { // Some error may have occured during reading the tips file. // Display a welcome text. widget->setTipOfTheDay(QString::fromLatin1("<h2>%1</h2>").arg(tr("Welcome to OpenOrienteering Mapper!"))); } else { Q_ASSERT(tips.count() > 0); while (index < 0) index += tips.count(); current_tip = index % tips.count(); widget->setTipOfTheDay(tips[current_tip]); } }
void SyntheticDataGenerator::ReadJointAndTipTrajectory(std::string _jointTipTrajectoryfile, bool isEMmeasurement) { int numTubes = this->robot->GetNumOfTubes(); this->jointTrajectory.clear(); this->tipTrajectory.clear(); std::vector<::std::string> lineVector = ReadLinesFromFile(_jointTipTrajectoryfile); for(int i = 0; i < lineVector.size() ; ++i) { std::vector<double> doubleLineVector = DoubleVectorFromString(lineVector[i]); std::vector<double> joint(doubleLineVector.begin(), doubleLineVector.begin() + 2*numTubes+1), tip(doubleLineVector.begin()+2*numTubes+1, doubleLineVector.end()); // For now, tip has EM tracker frame. EM tracker has been attached on the robot tip // with its x-axis colinearly aligned to z-axis of robot tip in opposite direction. // So, the following lines swaps the x- and z-axes with proper signs. // Note that it doesn't mean 'tip' is the correct tip orientation. It is correct with z-axis, // but not correct with x- and y- axis. if(isEMmeasurement) for(int j = 0 ; j < 3; j++) { double temp = tip[3+j]; tip[3+j] = tip[9+j]; tip[9+j] = -temp; } this->jointTrajectory.push_back(joint); this->tipTrajectory.push_back(tip); } }
bool CalloutPointerItem::autoLocFromLoc( QPoint loc) { QRect rect(0, 0, callout->size[XX], callout->size[YY]); QPoint intersect; PlacementEnc tplacement; QPoint tip(points[Tip].x() + 0.5, points[Tip].y() + 0.5); if (rectLineIntersect(tip, loc, rect, borderThickness, intersect, tplacement)) { placement = tplacement; points[Base] = intersect; return true; } return false; }
void Cone::updateBufferNormals() { GLfloat (*N)[3]; int i; list<Vec4> points; list<Vec4>::iterator curr, next; Vec4 normal, tip(0,0,-1,1); // Initialize N = new GLfloat[getCount()][3]; points = Math::computeCircle(0.5, getCount() / 3); points.push_back(Vec4(0.5,0,0,1)); // Fill array curr = points.begin(); next = ++(points.begin()); while (next != points.end()) { i = distance(points.begin(), curr) * 3; normal = cross(tip-*curr, *next-*curr); for (int j=0; j<3; ++j) { N[ i ][j] = normal[j]; N[i+1][j] = normal[j]; N[i+2][j] = normal[j]; } ++curr; ++next; } // Send to buffer setBufferData("MCNormal", N); delete[] N; }
void show(CVideo& video, const std::string& window_id, const t_string& message, const tpoint& mouse) { /* * For now allow invalid tip names, might turn them to invalid wml messages * later on. */ ttip& t = tip(); t.set_window_id(window_id); t.set_message(message); t.set_mouse(mouse); try { t.show(video); } catch(twindow_builder_invalid_id&) { ERR_CFG << "Tip with the requested id '" << window_id << "' doesn't exist, fall back to the default.\n"; t.set_window_id("tooltip_large"); try { t.show(video); } catch(twindow_builder_invalid_id&) { ERR_CFG << "Default tooltip doesn't exist, no message shown." << std::endl; } } }
/****************************************************************************** * Displays the full alarm text in a tooltip, if not all the text is displayed. */ void AlarmListTooltip::maybeTip(const QPoint &pt) { AlarmListView *listView = (AlarmListView *)parentWidget()->parentWidget(); int column = listView->column(AlarmListView::MESSAGE_COLUMN); int xOffset = listView->contentsX(); if(listView->header()->sectionAt(pt.x() + xOffset) == column) { AlarmListViewItem *item = (AlarmListViewItem *)listView->itemAt(pt); if(item) { int columnX = listView->header()->sectionPos(column) - xOffset; int columnWidth = listView->columnWidth(column); int widthNeeded = item->messageColWidthNeeded(); if(!item->messageTruncated() && columnWidth >= widthNeeded) { if(columnX + widthNeeded <= listView->viewport()->width()) return; } QRect rect = listView->itemRect(item); rect.setLeft(columnX); rect.setWidth(columnWidth); kdDebug(5950) << "AlarmListTooltip::maybeTip(): display\n"; tip(rect, AlarmText::summary(item->event(), 10)); // display up to 10 lines of text } } }
void Cone::updateBufferPoints() { GLfloat (*P)[3]; int i; list<Vec4> points; list<Vec4>::iterator curr, next; Vec4 tip(0,0,-1,1); // Initialize P = new GLfloat[getCount()][3]; points = Math::computeCircle(0.5, getCount() / 3); points.push_back(Vec4(0.5,0,0,1)); // Fill array curr = points.begin(); next = ++(points.begin()); while (next != points.end()) { i = distance(points.begin(), curr) * 3; for (int j=0; j<3; ++j) { P[ i ][j] = (*curr)[j]; P[i+1][j] = tip[j]; P[i+2][j] = (*next)[j]; } ++curr; ++next; } // Send to buffer setBufferData("MCVertex", P); delete[] P; }
void main() { int n; while(1) { tip(); menu(); scanf("%d",&n); if(n==0) break; switch(n) { case 1: benjin();break; case 2: fuli();break; case 3: danli();break; case 4: shijian();break; case 5: lilu();break; case 6: nianjinzhongzhi();break; case 7: dengebenxi();break; case 0: n=0; break; } } }
void K3bDeviceTreeToolTip::maybeTip( const QPoint& pos ) { if( !parentWidget() || !m_view ) return; K3bDeviceBranchViewItem* item = dynamic_cast<K3bDeviceBranchViewItem*>( m_view->itemAt( pos ) ); if( !item ) return; K3bDevice::Device* dev = static_cast<K3bDeviceBranch*>( item->branch() )->device(); QFrame* tooltip = new QFrame( parentWidget() ); tooltip->setFrameStyle( QFrame::Panel | QFrame::Raised ); tooltip->setFrameShape( QFrame::StyledPanel ); QGridLayout* lay = new QGridLayout( tooltip, 2, 2, tooltip->frameWidth()*2 /*margin*/, 6 /*spacing*/ ); QString text = k3bappcore->mediaCache()->medium( dev ).longString(); int detailsStart = text.find( "<p>", 3 ); QString details = text.mid( detailsStart ); text.truncate( detailsStart ); QLabel* label = new QLabel( text, tooltip ); label->setMargin( 9 ); lay->addMultiCellWidget( label, 0, 0, 0, 1 ); label = new QLabel( details, tooltip ); label->setMargin( 9 ); label->setAlignment( Qt::Vertical ); lay->addMultiCellWidget( label, 1, 2, 0, 0 ); label = new QLabel( tooltip ); lay->addWidget( label, 2, 1 ); lay->setColStretch( 0, 1 ); if( K3bTheme* theme = k3bappcore->themeManager()->currentTheme() ) { tooltip->setPaletteBackgroundColor( theme->backgroundColor() ); tooltip->setPaletteForegroundColor( theme->foregroundColor() ); K3bTheme::PixmapType pm; int c = k3bappcore->mediaCache()->medium( dev ).content(); if( c & (K3bMedium::CONTENT_VIDEO_CD|K3bMedium::CONTENT_VIDEO_DVD) ) pm = K3bTheme::MEDIA_VIDEO; else if( c & K3bMedium::CONTENT_AUDIO && c & K3bMedium::CONTENT_DATA ) pm = K3bTheme::MEDIA_MIXED; else if( c & K3bMedium::CONTENT_AUDIO ) pm = K3bTheme::MEDIA_AUDIO; else if( c & K3bMedium::CONTENT_DATA ) pm = K3bTheme::MEDIA_DATA; else { K3bDevice::DiskInfo di = k3bappcore->mediaCache()->diskInfo( dev ); if( di.diskState() == K3bDevice::STATE_EMPTY ) pm = K3bTheme::MEDIA_EMPTY; else pm = K3bTheme::MEDIA_NONE; } label->setPixmap( theme->pixmap( pm ) ); } // the tooltip will take care of deleting the widget tip( m_view->itemRect( item ), tooltip ); }
void WArcCreator::start() { clear(); WGraphicsLayer* layer = scene()->addLayer(WCreatorSettings::instance().layer()); layer->setEditable(true); scene()->setCurrentLayer(layer); emit tip("press left button to select rectangle's top left point or press right button to cancel"); }
void SeafileTrayIcon::resetToolTip () { QString tip("Seafile"); if (!seafApplet->settingsManager()->autoSync()) tip = tr("Auto sync is disabled"); setToolTip(tip); }
void ToolTipManager::Bind(wxWindow *window, wxString tooltip, const char *context, const char *command) { ToolTipBinding tip(window, tooltip, command, context); tip.Update(); static ToolTipManager instance; instance.tips.push_back(tip); hotkey::inst->AddHotkeyChangeListener(&ToolTipBinding::Update, &instance.tips.back()); }
virtual void maybeTip(const QPoint &pt) { QRect rc( mWidget->rect()); if (rc.contains(pt)) { tip ( rc, mPlayer->getTrackTitle() ); } }
void SeafileTrayIcon::resetToolTip () { QString tip(SEAFILE_CLIENT_BRAND); if (!seafApplet->settingsManager()->autoSync()) { tip = tr("auto sync is disabled"); } setToolTip(tip); }
void KonqSidebarTreeToolTip::maybeTip( const QPoint &point ) { QListViewItem *item = m_view->itemAt( point ); if ( item ) { QString text = static_cast<KonqSidebarTreeItem*>( item )->toolTipText(); if ( !text.isEmpty() ) tip ( m_view->itemRect( item ), text ); } }
/** * Called when the pre-conditions for a tool tip are met. * Asks the owner for a tip to display and, if one is returned, shows * the tool tip. * @param ptPos Current mouse position */ virtual void maybeTip(const QPoint& ptPos) { QString sText; QRect rc; // Display a tip, if required by the owner sText = m_pGraphWidget->getTip(ptPos, rc); if (sText != QString::null) tip(rc, sText); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); TpListener listener; listener.initConnection(); TipWidget tip("Soulxu", "This is a test message!"); tip.show(); return a.exec(); }
void DynamicTip::maybeTip( const QPoint &pos ) { if( tekst.isEmpty()) return; QRect r = QRect (pos, pos); tip( r, tekst.fromLocal8Bit(tekst)); }
void mmErrorDialogs::InvalidPayee(wxWindow *object) { const wxString& errorHeader = _("Invalid Payee"); const wxString& errorMessage = (_("Please type in a new payee,\nor make a selection using the dropdown button.") + "\n"); wxRichToolTip tip(errorHeader, errorMessage); tip.SetIcon(wxICON_WARNING); tip.ShowFor(object); }
void mmErrorDialogs::InvalidCategory(wxWindow *win, bool simple) { const wxString& msg = simple ? _("Please use this button for category selection.") : _("Please use this button for category selection\nor use the 'Split' checkbox for multiple categories."); wxRichToolTip tip(_("Invalid Category"), msg + "\n"); tip.SetIcon(wxICON_WARNING); tip.ShowFor(win); }
/*! \fn SnippetWidget::maybeTip( const QPoint & p ) Shows the Snippet-Text as ToolTip */ void SnippetWidget::maybeTip( const QPoint & p ) { SnippetItem * item = dynamic_cast<SnippetItem*>( itemAt( p ) ); if (!item) return; QRect r = itemRect( item ); if (r.isValid() && _SnippetConfig.useToolTips() ) { if (dynamic_cast<SnippetGroup*>(item)) { tip( r, i18n("Language:")+((SnippetGroup*)item)->getLanguage() ); //show the group's language } else { tip( r, item->getText() ); //show the snippet's text } } }
void mmErrorDialogs::InvalidFile(wxWindow *object, bool open) { const wxString errorHeader = open ? _("Unable to open file.") : _("File name is empty."); const wxString errorMessage = _("Please select the file for this operation."); wxRichToolTip tip(errorHeader, errorMessage); tip.SetIcon(wxICON_WARNING); tip.ShowFor(object); }
virtual void maybeTip(const QPoint &point) { QListBoxItem *item = m_view->itemAt(point); if(item) { QString text = static_cast< KURLBarItem * >(item)->toolTip(); if(!text.isEmpty()) tip(m_view->itemRect(item), text); } }
void VariableTree::maybeTip(const QPoint &p) { VarItem * item = dynamic_cast<VarItem*>( itemAt(p) ); if (item != 0) { QRect r = itemRect(item); if (r.isValid()) { tip(r, item->tipText()); } } }
void KbStatusTip::ShowStatus(QString msg) { if ((QCursor::pos().x() > parentWidget()->mapToGlobal(parentWidget()->pos()).x()) && (QCursor::pos().y() > parentWidget()->mapToGlobal(parentWidget()->pos()).y()) && (QCursor::pos().x() < (parentWidget()->mapToGlobal(parentWidget()->pos()).x() + parentWidget()->width())) && (QCursor::pos().y() < (parentWidget()->mapToGlobal(parentWidget()->pos()).y() + parentWidget()->height()))) { tip(parentWidget()->rect(), msg); } }
void maybeTip( const QPoint &pos ) { QListViewItem *i = m_listView->itemAt( pos ); if ( ! i ) return; KateFileListItem *item = ((KateFileListItem*)i); if ( ! item ) return; tip( m_listView->itemRect( i ), m_listView->tooltip( item, 0 ) ); }