Vim – Character Encoding

Sometimes we need to check character encoding for special word, or by contrast, to input some special words according to character encoding. The article will show you how to handle the two situations. Find the character encoding for special world Move the cursor at the character and input ga normal Read more…

Vim – Edit Multiple Files

Open multiple files Open multiple files on the horizontal direction: vim -o file1 file2 file3 ….Switch edit file:ctrl + ww.Close all opened files without saving operation:qa.Multiple fails in the vertical direction: vim -O file1 file2 file3 ….Add a number n after -o, we can open multiple files in multiple split windows). Split window Add a Read more…

QT – Common Setting For Window

Borderless window: setWindowFlags( Qt::FramelessWindowHint ); Set background color: QPalette pal = mainWin->Getui().qvtkWidget->palette(); pal.setColor( QPalette::Background, Qt::black ); setAutoFillBackground( true ); this->setPalette( pal ); Make window stay on the top level: setWindowFlags(Qt::WindowStaysOnTopHint) Remove maximize button in widget: setWindowFlags( this->windowFlags() & ~Qt::WindowMaximizeButtonHint ); Definite buttons on title bar: setWindowFlags( Qt::CustomizeWindowHint | Qt::WindowMaximizeButtonHint); //Only Read more…

QT – QTest event, QSignalSpy and installEventFilter

The interfaces can imitate users’ operations. QTest::keyClick QTest::keyPress QTest::mouseClick QSignalSpy listens for signal emission, it is a list of QVariant lists. It will not shield off signal to make slot invalid. QCheckBox *box = …; QSignalSpy spy(box, SIGNAL(clicked(bool))); //… QList arguments = spy.takeFirst(); // take the first signal QVERIFY(arguments.at(0).toBool() == Read more…

Unit Test Based On QT

Simple Unit Test Project Let’s create a new unit test project firstly. Write our test functions in feild private Q_SLOTS for the class. tst_string.cpp: #include <QString> #include <QtTest> class String : public QObject { Q_OBJECT public: String(); private Q_SLOTS: void toUpper(); }; String::String() { } void String::toUpper() { QVERIFY2(true, “Failure”); Read more…

VTK – Update Different Views When Selections Changed

The article shows how to use vtkViewUpdater to update different views when the selections changed. Relevant development environment: VTK-8.1.1; Qt 5.11.2 (x86_64-little_endian-lp64 shared (dynamic) release build; Clang 8.1.0 (clang-802.0.42) (Apple)) on “cocoa”; macOS 10.14 [darwin version 18.5.0]; #include <QApplication> #include <qsurfaceformat.h> #include <QVTKOpenGLWidget.h> #include <vtkRandomGraphSource.h> #include <vtkDataObjectToTable.h> #include <vtkQtTableView.h> #include Read more…

Tex To PDF
: convert the Latex file which suffix is tex to a PDF file

X