diff options
author | Slávek Banko <[email protected]> | 2016-04-10 10:42:00 +0200 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2016-04-10 10:42:00 +0200 |
commit | 7fdc8b30e85418cca031b45ad02f723373b73433 (patch) | |
tree | 491150f68ddc476645599a00d04e27b194e9648c /src/tastylistview.cpp | |
parent | 3566ebfc3015ab32c4e0531defb41377c171fadb (diff) | |
download | tastymenu-7fdc8b30e85418cca031b45ad02f723373b73433.tar.gz tastymenu-7fdc8b30e85418cca031b45ad02f723373b73433.zip |
Initial TQt conversion
Signed-off-by: Slávek Banko <[email protected]>
Diffstat (limited to 'src/tastylistview.cpp')
-rw-r--r-- | src/tastylistview.cpp | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/src/tastylistview.cpp b/src/tastylistview.cpp index ed5e2a7..30d98a8 100644 --- a/src/tastylistview.cpp +++ b/src/tastylistview.cpp @@ -24,19 +24,19 @@ #include <kdeversion.h> #include <kstringhandler.h> -#include <qimage.h> -#include <qpainter.h> -#include <qheader.h> +#include <tqimage.h> +#include <tqpainter.h> +#include <tqheader.h> #include <klocale.h> #include <kurldrag.h> -#include <qapplication.h> +#include <tqapplication.h> -TastyListView::TastyListView( QWidget * parent, const char * name) +TastyListView::TastyListView( TQWidget * parent, const char * name) : KListView(parent, name), highLightGroups(true), easyOpen(true) { - onItemTimer = new QTimer(this, "onItemTimer"); + onItemTimer = new TQTimer(this, "onItemTimer"); underCursorItem = openItem = NULL; mouseDown = false; actionIconSize = 16; @@ -44,7 +44,7 @@ TastyListView::TastyListView( QWidget * parent, const char * name) listItemTip = new TastyListViewToolTip(viewport(), this); - connect(this, SIGNAL(onItem(QListViewItem *) ), SLOT(slotOnItem(QListViewItem *) ) ); + connect(this, SIGNAL(onItem(TQListViewItem *) ), SLOT(slotOnItem(TQListViewItem *) ) ); connect(onItemTimer, SIGNAL(timeout()), this, SLOT(slotTimeout()) ); } @@ -61,7 +61,7 @@ void TastyListView::startDrag() if( !item ) return; - QDragObject *d = new KURLDrag( KURL(item->getDeskopEntryPath()) , viewport() ); + TQDragObject *d = new KURLDrag( KURL(item->getDeskopEntryPath()) , viewport() ); if(!d) return; @@ -69,7 +69,7 @@ void TastyListView::startDrag() emit moved(); } -void TastyListView::contentsMouseReleaseEvent( QMouseEvent * e ) +void TastyListView::contentsMouseReleaseEvent( TQMouseEvent * e ) { int x = e->x(); if( x > width() || x < 0) @@ -84,7 +84,7 @@ void TastyListView::contentsMouseReleaseEvent( QMouseEvent * e ) if( e->button() == RightButton ) emit(contextMenuRequested( currentItem(), e->globalPos(), 0) ); else - emit(activated( currentItem(), QPoint(x, e->y()), 0) ); + emit(activated( currentItem(), TQPoint(x, e->y()), 0) ); if(item && (item->getType() == TastyListViewItem::ServiceGroup)) { @@ -104,16 +104,16 @@ void TastyListView::contentsMouseReleaseEvent( QMouseEvent * e ) KListView::contentsMouseReleaseEvent(e); } -void TastyListView::contentsMouseMoveEvent( QMouseEvent * e ) +void TastyListView::contentsMouseMoveEvent( TQMouseEvent * e ) { KListView::contentsMouseMoveEvent(e); - mouseDown = (e->state() & Qt::LeftButton); + mouseDown = (e->state() & TQt::LeftButton); - if( itemAt( contentsToViewport(QPoint(e->x(), e->y()))) == 0 ) + if( itemAt( contentsToViewport(TQPoint(e->x(), e->y()))) == 0 ) underCursorItem = NULL; } -void TastyListView::leaveEvent( QEvent * e ) +void TastyListView::leaveEvent( TQEvent * e ) { KListView::leaveEvent( e ); onItemTimer->stop(); @@ -122,16 +122,16 @@ void TastyListView::leaveEvent( QEvent * e ) } -void TastyListView::keyPressEvent( QKeyEvent * e ) +void TastyListView::keyPressEvent( TQKeyEvent * e ) { switch(e->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: - case Qt::Key_Space: + case TQt::Key_Enter: + case TQt::Key_Return: + case TQt::Key_Space: { - emit(activated(currentItem(), QPoint(0,0), 0)); + emit(activated(currentItem(), TQPoint(0,0), 0)); if(!currentItem()) return; TastyListViewItem *item = dynamic_cast<TastyListViewItem *>(currentItem()); @@ -152,19 +152,19 @@ void TastyListView::keyPressEvent( QKeyEvent * e ) } break; - case Qt::Key_Up: - case Qt::Key_Down: + case TQt::Key_Up: + case TQt::Key_Down: KListView::keyPressEvent( e ); break; - case Qt::Key_Right: + case TQt::Key_Right: { if(!currentItem()) return; TastyListViewItem *item = dynamic_cast<TastyListViewItem *>(currentItem()); - if(item && easyOpen && !QApplication::reverseLayout() && item->getType() == TastyListViewItem::ServiceGroup) + if(item && easyOpen && !TQApplication::reverseLayout() && item->getType() == TastyListViewItem::ServiceGroup) { - emit( activated( currentItem(), QPoint(0,0), 0)); + emit( activated( currentItem(), TQPoint(0,0), 0)); if( !openItem ) { openItem = currentItem(); @@ -177,17 +177,17 @@ void TastyListView::keyPressEvent( QKeyEvent * e ) oldOpenItem->repaint(); } - focusNextPrevChild(!QApplication::reverseLayout()); + focusNextPrevChild(!TQApplication::reverseLayout()); break; } - case Qt::Key_Left: + case TQt::Key_Left: { if( !currentItem() ) return; TastyListViewItem *item = dynamic_cast<TastyListViewItem *>(currentItem()); - if(item && easyOpen && QApplication::reverseLayout() && item->getType() == TastyListViewItem::ServiceGroup) + if(item && easyOpen && TQApplication::reverseLayout() && item->getType() == TastyListViewItem::ServiceGroup) { - emit( activated( currentItem(), QPoint(0,0), 0)); + emit( activated( currentItem(), TQPoint(0,0), 0)); if( !openItem ) { openItem = currentItem(); @@ -200,10 +200,10 @@ void TastyListView::keyPressEvent( QKeyEvent * e ) oldOpenItem->repaint(); } - focusNextPrevChild(QApplication::reverseLayout()); + focusNextPrevChild(TQApplication::reverseLayout()); break; } - case Qt::Key_Tab: + case TQt::Key_Tab: KListView::keyPressEvent( e ); break; @@ -213,7 +213,7 @@ void TastyListView::keyPressEvent( QKeyEvent * e ) } -void TastyListView::slotOnItem( QListViewItem * listItem ) +void TastyListView::slotOnItem( TQListViewItem * listItem ) { if( !listItem || listItem->listView() != this ) return; @@ -239,7 +239,7 @@ void TastyListView::slotTimeout( ) if( easyOpen && tastyUnderCursorItem && tastyUnderCursorItem->getType() == TastyListViewItem::ServiceGroup ) { - emit(activated(underCursorItem, QPoint(underCursorItem->listView()->width()/2,1), 0)); + emit(activated(underCursorItem, TQPoint(underCursorItem->listView()->width()/2,1), 0)); TastyListViewItem *oldOpenItem = dynamic_cast<TastyListViewItem *>(openItem); openItem = currentItem(); if( !oldOpenItem || !oldOpenItem->listView() ) @@ -250,18 +250,18 @@ void TastyListView::slotTimeout( ) } ///////////TASTYLISTVIEWTOOLTIP -TastyListViewToolTip::TastyListViewToolTip( QWidget *parent, TastyListView *tListView ) - : QToolTip( parent ), listView( tListView ) +TastyListViewToolTip::TastyListViewToolTip( TQWidget *parent, TastyListView *tListView ) + : TQToolTip( parent ), listView( tListView ) { } -void TastyListViewToolTip::maybeTip( const QPoint &pos ) +void TastyListViewToolTip::maybeTip( const TQPoint &pos ) { if( !parentWidget() || !listView || !listView->showToolTips() ) return; TastyListViewItem *item = static_cast<TastyListViewItem *>(listView->itemAt( pos )); - QPoint contentsPos = listView->viewportToContents( pos ); + TQPoint contentsPos = listView->viewportToContents( pos ); if( !item || !listView->columns() ) return; @@ -273,7 +273,7 @@ void TastyListViewToolTip::maybeTip( const QPoint &pos ) int column = listView->header()->sectionAt( contentsPos.x() ); - QRect r = listView->itemRect( item ); + TQRect r = listView->itemRect( item ); int headerPos = listView->header()->sectionPos( column ); r.setLeft( headerPos ); r.setRight( headerPos + listView->header()->sectionSize( column ) ); @@ -330,19 +330,19 @@ TastyListViewItem::TastyListViewItem( TastyListViewItem * parent ) : KListViewItem(parent) {commonConstructor();} -TastyListViewItem::TastyListViewItem( TastyListView * parent, TastyListViewItem * after, QString label1 ) +TastyListViewItem::TastyListViewItem( TastyListView * parent, TastyListViewItem * after, TQString label1 ) : KListViewItem(parent, after, label1) {commonConstructor();cellText = label1;} -TastyListViewItem::TastyListViewItem( TastyListViewItem * parent, TastyListViewItem * after, QString label1 ) +TastyListViewItem::TastyListViewItem( TastyListViewItem * parent, TastyListViewItem * after, TQString label1 ) : KListViewItem(parent, after, label1) {commonConstructor();cellText = label1;} -TastyListViewItem::TastyListViewItem( TastyListView * parent, QString label1 ) +TastyListViewItem::TastyListViewItem( TastyListView * parent, TQString label1 ) : KListViewItem(parent, label1) {commonConstructor();cellText = label1;} -TastyListViewItem::TastyListViewItem( TastyListViewItem * parent, QString label1 ) +TastyListViewItem::TastyListViewItem( TastyListViewItem * parent, TQString label1 ) : KListViewItem(parent, label1) {commonConstructor();cellText = label1;} @@ -357,11 +357,11 @@ void TastyListViewItem::commonConstructor() actionType = NoAction; - actionPix = QPixmap(); + actionPix = TQPixmap(); - menuId = QString(); - desktopEntryPath = QString(); - path = QString(); + menuId = TQString(); + desktopEntryPath = TQString(); + path = TQString(); ellipsis = false; highLight = false; @@ -371,7 +371,7 @@ void TastyListViewItem::commonConstructor() void TastyListViewItem::loadPixmap() { - QString iconFile = ""; + TQString iconFile = ""; iconLoader = KGlobal::iconLoader(); if( !listView() ) @@ -392,7 +392,7 @@ void TastyListViewItem::loadPixmap() break; case OpenGroup: - if( QApplication::reverseLayout() ) + if( TQApplication::reverseLayout() ) actionPix = iconLoader->loadIcon("1leftarrow", KIcon::Small, lv->getActionIconSize()); else actionPix = iconLoader->loadIcon("1rightarrow", KIcon::Small, lv->getActionIconSize()); @@ -413,19 +413,19 @@ void TastyListViewItem::loadPixmap() if ( actionPix.height () > lv->getActionIconSize()) { - QImage img = actionPix.convertToImage(); + TQImage img = actionPix.convertToImage(); if( !img.isNull() ) { img = img.smoothScale ( lv->getActionIconSize(), lv->getActionIconSize()); - actionPix = QPixmap (img); + actionPix = TQPixmap (img); } } } -QString TastyListViewItem::key( int column, bool ascending ) const +TQString TastyListViewItem::key( int column, bool ascending ) const { ascending = ascending; - QString prefix; + TQString prefix; //ensure all the categories are before the leaf items if( itemType == ServiceGroup ) @@ -440,7 +440,7 @@ void TastyListViewItem::setup ( ) //KListViewItem::setup(); //calculate listitem height - QFontMetrics fm( listView()->font() ); + TQFontMetrics fm( listView()->font() ); int pixmapHeight = 5; if( pixmap(0) ) @@ -457,14 +457,14 @@ void TastyListViewItem::setup ( ) /*Adapted from Amarok's Statistic listView Copyright (c) 2006 Seb Ruiz*/ -void TastyListViewItem::paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align ) +void TastyListViewItem::paintCell ( TQPainter * p, const TQColorGroup & cg, int column, int width, int align ) { int textHeight = height(); - QString name = cellText; + TQString name = cellText; int textX = 0; - QColor fillColor, textColor; + TQColor fillColor, textColor; # if KDE_VERSION < KDE_MAKE_VERSION(3,3,91) # define BackgroundColor backgroundColor() @@ -483,7 +483,7 @@ void TastyListViewItem::paintCell ( QPainter * p, const QColorGroup & cg, int co if( !lv ) return; - QFont font( lv->font() ); + TQFont font( lv->font() ); if( !isSelected() && (lv->getOpenItem() == this|| (lv->getHighLightGroups() && itemType == ServiceGroup)) ) @@ -500,17 +500,17 @@ void TastyListViewItem::paintCell ( QPainter * p, const QColorGroup & cg, int co else if( isSelected() && !lv->hasFocus() ) fillColor = alphaBlendColors( fillColor, BackgroundColor, 150); - QFontMetrics fm( font ); + TQFontMetrics fm( font ); widthChanged(column); - QPixmap buffer(width*2, textHeight); + TQPixmap buffer(width*2, textHeight); if( buffer.isNull() ) return; buffer.fill( fillColor ); - QPainter pBuf(&buffer); + TQPainter pBuf(&buffer); if( pixmap( column ) ) @@ -557,8 +557,8 @@ void TastyListViewItem::paintCell ( QPainter * p, const QColorGroup & cg, int co font.setPointSize( max((int)(font.pointSize()/1.2), 7) ); pBuf.setFont( font ); - QString subTextCopy = subText; - QFontMetrics sfm( font ); + TQString subTextCopy = subText; + TQFontMetrics sfm( font ); //Calculate the ellipsis for the subtext int extraSpace = fm.width("...") + textX + lv->getActionIconSpace(); |