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 );
59 mButton->setToolTip(
tr(
"No messages." ) );
64 statusBar->addPermanentWidget(
mButton, 0 );
67 connect( tabWidget, SIGNAL( tabCloseRequested(
int ) ),
this, SLOT(
closeTab(
int ) ) );
93 QWidget *w = qobject_cast<QDockWidget *>( parent() );
116 QToolTip::showText(
mButton->mapToGlobal( QPoint( 0, 0 ) ),
mButton->toolTip() );
120 tag =
tr(
"General" );
123 for ( i = 0; i < tabWidget->count() && tabWidget->tabText( i ) != tag; i++ )
127 if ( i < tabWidget->count() )
129 w = qobject_cast<QTableWidget *>( tabWidget->widget( i ) );
130 tabWidget->setCurrentIndex( i );
134 w =
new QTableWidget( 0, 3,
this );
135 w->verticalHeader()->setDefaultSectionSize( 16 );
136 w->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );
137 w->verticalHeader()->setVisible(
false );
138 w->setGridStyle( Qt::DotLine );
139 w->setEditTriggers( QAbstractItemView::NoEditTriggers );
140 w->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );
141 w->setHorizontalHeaderLabels( QStringList() <<
tr(
"Timestamp" ) <<
tr(
"Message" ) <<
tr(
"Level" ) );
142 tabWidget->addTab( w, tag );
144 tabWidget->setCurrentIndex( tabWidget->count() - 1 );
147 int n = w->rowCount();
149 w->setRowCount( n + 1 );
150 QTableWidgetItem *item =
new QTableWidgetItem( QDateTime::currentDateTime().toString( Qt::ISODate ) );
151 w->setItem( n, 0, item );
152 w->setItem( n, 1,
new QTableWidgetItem( message ) );
153 w->setItem( n, 2,
new QTableWidgetItem( QString::number( level ) ) );
156 w->horizontalHeader()->resizeSections( QHeaderView::ResizeToContents );
161 QTableWidget *w = qobject_cast<QTableWidget *>( tabWidget->widget( index ) );
168 tabWidget->removeTab( index );