Set header texts.

--HG--
branch : gsoc2014-dfighter
This commit is contained in:
dfighter1985 2014-07-17 19:17:02 +02:00
parent d33fb9345e
commit 0de5152aa9
2 changed files with 42 additions and 28 deletions

View file

@ -50,6 +50,8 @@ void UXTEditor::open( QString filename )
d_ptr->t->setColumnCount( 2 ); d_ptr->t->setColumnCount( 2 );
d_ptr->t->setRowCount( infos.size() ); d_ptr->t->setRowCount( infos.size() );
setHeaderText( "Id", "Text" );
int i = 0; int i = 0;
std::vector< STRING_MANAGER::TStringInfo >::const_iterator itr = infos.begin(); std::vector< STRING_MANAGER::TStringInfo >::const_iterator itr = infos.begin();
@ -93,4 +95,14 @@ void UXTEditor::closeEvent( QCloseEvent *e )
close(); close();
} }
void UXTEditor::setHeaderText( const QString &id, const QString &text )
{
QTableWidgetItem *h1 = new QTableWidgetItem( id );
QTableWidgetItem *h2 = new QTableWidgetItem( text );
h1->setTextAlignment( Qt::AlignLeft );
h2->setTextAlignment( Qt::AlignLeft );
d_ptr->t->setHorizontalHeaderItem( 0, h1 );
d_ptr->t->setHorizontalHeaderItem( 1, h2 );
}
} }

View file

@ -1,33 +1,35 @@
#ifndef UXT_EDITOR_H #ifndef UXT_EDITOR_H
#define UXT_EDITOR_H #define UXT_EDITOR_H
#include "translation_manager_editor.h" #include "translation_manager_editor.h"
namespace TranslationManager namespace TranslationManager
{ {
class UXTEditorPvt; class UXTEditorPvt;
class UXTEditor : public CEditor class UXTEditor : public CEditor
{ {
Q_OBJECT Q_OBJECT
public: public:
UXTEditor( QMdiArea *parent = NULL ); UXTEditor( QMdiArea *parent = NULL );
~UXTEditor(); ~UXTEditor();
void open( QString filename ); void open( QString filename );
void save(); void save();
void saveAs( QString filename ); void saveAs( QString filename );
void activateWindow(); void activateWindow();
protected: protected:
void closeEvent( QCloseEvent *e ); void closeEvent( QCloseEvent *e );
private: private:
UXTEditorPvt *d_ptr; void setHeaderText( const QString &id, const QString &text );
};
UXTEditorPvt *d_ptr;
} };
#endif }
#endif