24 #include <QTableWidget>
25 #include <QToolButton>
28 #include <QDockWidget>
34 if ( QFile::exists( path + icon ) )
43 : QDialog( parent, fl )
54 mButton =
new QToolButton( parent );
55 mButton->setObjectName(
"mMessageLogViewerButton" );
57 mButton->setMaximumHeight( 20 );
60 mButton->setToolTip(
tr(
"No messages." ) );
66 statusBar->addPermanentWidget(
mButton, 0 );
69 connect( tabWidget, SIGNAL( tabCloseRequested(
int ) ),
this, SLOT(
closeTab(
int ) ) );
95 QWidget *w = qobject_cast<QDockWidget *>( parent() );
122 QToolTip::showText(
mButton->mapToGlobal( QPoint( 0, 0 ) ),
mButton->toolTip() );
126 tag =
tr(
"General" );
129 for ( i = 0; i < tabWidget->count() && tabWidget->tabText( i ) != tag; i++ )
133 if ( i < tabWidget->count() )
135 w = qobject_cast<QTableWidget *>( tabWidget->widget( i ) );
136 tabWidget->setCurrentIndex( i );
140 w =
new QTableWidget( 0, 3,
this );
141 w->verticalHeader()->setDefaultSectionSize( 16 );
142 w->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );
143 w->verticalHeader()->setVisible(
false );
144 w->setGridStyle( Qt::DotLine );
145 w->setEditTriggers( QAbstractItemView::NoEditTriggers );
146 w->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );
147 w->setHorizontalHeaderLabels( QStringList() <<
tr(
"Timestamp" ) <<
tr(
"Message" ) <<
tr(
"Level" ) );
148 tabWidget->addTab( w, tag );
150 tabWidget->setCurrentIndex( tabWidget->count() - 1 );
153 int n = w->rowCount();
155 w->setRowCount( n + 1 );
156 QTableWidgetItem *item =
new QTableWidgetItem( QDateTime::currentDateTime().toString( Qt::ISODate ) );
157 w->setItem( n, 0, item );
158 w->setItem( n, 1,
new QTableWidgetItem( message ) );
159 w->setItem( n, 2,
new QTableWidgetItem( QString::number( level ) ) );
162 w->horizontalHeader()->resizeSections( QHeaderView::ResizeToContents );
167 QTableWidget *w = qobject_cast<QTableWidget *>( tabWidget->widget( index ) );
178 tabWidget->removeTab( index );