Wednesday

Qt Yin Yang Symbol


Source code:

#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsEllipseItem>
 
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
 
    QGraphicsScene scene;
 
    scene.setSceneRect( 0.0, 0.0, 200.0, 200.0 );
 
    QBrush whiteBrush(Qt::white);
    QBrush blackBrush(Qt::black);
    QPen blackPen(Qt::black);
    blackPen.setWidth(3);
    QPen whitePen(Qt::white);
    whitePen.setWidth(3);
 
    scene.addEllipse(0,0,200,200,blackPen,blackBrush); //big circle
 
    QPainterPath rightWhiteSemicirclePath;
    rightWhiteSemicirclePath.arcMoveTo(0+3, 0+3, 200-2*3, 200-2*3, 90);
    rightWhiteSemicirclePath.arcTo(0+3, 0+3, 200-2*3, 200-2*3, 90, -180);
    scene.addPath(rightWhiteSemicirclePath,whitePen,whiteBrush);
 
    QPainterPath leftUpperSmallWhiteSemicirclePath;
    //circle contains in the square shape
    //square length is 100-3=97
    //move the small square x position left (1/4*200)+3=53 pixels
    leftUpperSmallWhiteSemicirclePath.arcMoveTo(50+3, 0+3, 100-3, 100-3, -90);
    leftUpperSmallWhiteSemicirclePath.arcTo(50+3, 0+3, 100-3, 100-3, -90, -180);
    scene.addPath(leftUpperSmallWhiteSemicirclePath,whitePen,whiteBrush);
 
    QPainterPath rightLowerSmallBlackSemicirclePath;
    rightLowerSmallBlackSemicirclePath.arcMoveTo(53-3, 100+3, 100-3, 100-3, 90);
    rightLowerSmallBlackSemicirclePath.arcTo(53-3, 100+3, 100-3, 100-3, 90, -180);
    scene.addPath(rightLowerSmallBlackSemicirclePath,blackPen,blackBrush);
 
    scene.addEllipse(100-12.5,  50-12.5, 25, 25, blackPen, blackBrush); //small black upper circle
    scene.addEllipse(100-12.5, 150-12.5, 25, 25, whitePen, whiteBrush); //small white lower circle
 
    QGraphicsView view( &scene );
    view.setFixedSize(300,300);
    view.setWindowTitle("My Yin Yang Symbol");
    view.show();
 
    return app.exec();
}
 
Result: 
 
 
 
 



Tuesday

Qt Smiley


ClipsTab (ClipsTab = Clips + Protege) Installation Steps

Step: Download and install Protege v3.4.7 from
http://protege.stanford.edu/download/protege/3.4/installanywhere/Web_Installers/.
Choose without Java VM if you have installed Java Virtual Machine already.

Step: Download and extract ClipsTab zip file from
http://protege.stanford.edu/plugins/CLIPSTabPages/clipstab.zip.
ClipsTab zip file contains two files. The files are clipstab.jar and ProtegeCLIPSInterface.dll.
Create a folder in the "C:\Program Files\Protege_3.4.7\plugins" and name the folder as "ClipsTab".
Copy clipstab.jar to the "C:\Program Files\Protege_3.4.7\plugins\ClipsTab" folder.
Copy ProtegeCLIPSInterface.dll to the "C:\Program Files\Protege_3.4.7" folder.

Step: In the "C:\Program Files\Protege_3.4.7\plugins\ClipsTab" folder, create a text file
and name the file as "plugin.properties".
Type the following text into the "plugin.properties" file:
--
plugin.component.count=1
plugin.component.name.0=ClipsTab Plugin
plugin.component.about.0=http://protege.stanford.edu/plugins/CLIPSTabPages/CLIPS_tab.html
plugin.component.doc.0=http://protege.stanford.edu/plugins/CLIPSTabPages/docs/index.html
plugin.dependency.count=2
plugin.dependency.0=edu.stanford.smi.protegex.owl
plugin.dependency.1=edu.stanford.smi.protegex.pal_tabs
--

Step: Download and extract Clips v6.24 zip file (windows_executables_624.zip) from
http://sourceforge.net/projects/clipsrules/files/CLIPS/6.24/.
Copy the following four files one file "clips.hlp, CLIPS6.HLP, clipsdos.exe, and CLIPSWin.exe" from the extracted Clips zip file to
the "C:\Program Files\Protege_3.4.7\plugins\ClipsTab" folder.

Step: Click [Start > All Programs > Protege_3.4.7 > Protege] to open Protege program.
On the Protege program, tick "CLIPSTab" and then click OK to enable the "CLIPS tab" under
[Menu > Project > Configure... > TabWidgets tab].

Wednesday

Simple Qt Console Application

  • Click Start Menu > All Programs > Qt SDK > Qt Creator to open Qt 4 C++ Editor.
  • On Qt Creator, click Menubar > File > New File or Project... Ctrl+N to create a new project.
  • At LHS panel, Choose a template: Other Project. At RHS panel, click Qt Console Application. Click "Choose..." button to create a project containing a single main.cpp file with a stub implementation.
  • Give the file a name as "cpp_simple_hello_world". Create in: D:\ws_qt. Click Next button to continue.
  • Uncheck "Qt 4.7.3  for Desktop - MSVC2008 (Qt SDK) debug" and "Qt 4.7.3  for Desktop - MSVC2008 (Qt SDK) release" if there is any. Click Next button to continue.
  • Click Finish.
  • In the main.cpp file, enter the following source code for the file content.
---------|---------|---------|---------|
#include <QtCore/QCoreApplication>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    cout << "Hello, World!" << endl;

    return a.exec();
}
---------|---------|---------|---------|
  • Ctrl+R to run the Qt (cute, cutie, Q.T. pronunciation) console application.

If a hater attacked your age and not the goodness of you

Whether young or old, I've always been known what endures. I've known the very idea of people that were all created equal and deserv...