ui: reworded file tooltips
* and added sample source
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
class Point
|
||||
{
|
||||
public:
|
||||
Point(int x, int y)
|
||||
: x(x)
|
||||
, y(y)
|
||||
{
|
||||
}
|
||||
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
|
||||
class Shape
|
||||
{
|
||||
public:
|
||||
virtual void draw() = 0;
|
||||
};
|
||||
|
||||
|
||||
class Line
|
||||
: public Shape
|
||||
{
|
||||
public:
|
||||
Line(Point start, Point end)
|
||||
: start(start)
|
||||
, end(end)
|
||||
{
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
// line drawing
|
||||
}
|
||||
|
||||
private:
|
||||
Point start;
|
||||
Point end;
|
||||
};
|
||||
|
||||
|
||||
class Circle
|
||||
: public Shape
|
||||
{
|
||||
public:
|
||||
Circle(Point center, int radius)
|
||||
: center(center)
|
||||
, radius(radius)
|
||||
{}
|
||||
|
||||
void draw()
|
||||
{
|
||||
// circle drawing
|
||||
}
|
||||
|
||||
private:
|
||||
Point center;
|
||||
int radius;
|
||||
};
|
||||
|
||||
|
||||
class Image
|
||||
{
|
||||
public:
|
||||
Image(int width, int height)
|
||||
: width(width)
|
||||
, height(height)
|
||||
, idx(0)
|
||||
{
|
||||
shapes = new Shape*[10];
|
||||
}
|
||||
|
||||
~Image()
|
||||
{
|
||||
for (int i = 0; i < idx; i++)
|
||||
{
|
||||
delete shapes[i];
|
||||
}
|
||||
|
||||
delete [] shapes;
|
||||
}
|
||||
|
||||
void addShape(Shape* shape)
|
||||
{
|
||||
if (idx < 10)
|
||||
{
|
||||
shapes[idx] = shape;
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
for (int i = 0; i < idx; i++)
|
||||
{
|
||||
shapes[i]->draw();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Shape** shapes;
|
||||
int idx;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
|
||||
void drawStickMan()
|
||||
{
|
||||
Image stickman(100, 200);
|
||||
|
||||
// head
|
||||
stickman.addShape(new Circle(Point(50, 50), 25));
|
||||
|
||||
// torso
|
||||
stickman.addShape(new Line(Point(50, 75), Point(50, 180)));
|
||||
|
||||
// arms
|
||||
stickman.addShape(new Line(Point(50, 100), Point(10, 125)));
|
||||
stickman.addShape(new Line(Point(50, 100), Point(90, 125)));
|
||||
|
||||
// legs
|
||||
stickman.addShape(new Line(Point(50, 100), Point(10, 125)));
|
||||
stickman.addShape(new Line(Point(50, 100), Point(90, 125)));
|
||||
|
||||
stickman.draw();
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
|
||||
int number = 3;
|
||||
|
||||
int calculate()
|
||||
{
|
||||
int a = 1 + 2;
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
int count = 0;
|
||||
|
||||
void countUp()
|
||||
{
|
||||
count += 1;
|
||||
}
|
||||
|
||||
void countDown()
|
||||
{
|
||||
count -= 1;
|
||||
}
|
||||
|
||||
|
||||
void countUpTen()
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
countUp();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Person
|
||||
{
|
||||
public:
|
||||
Person(char* name)
|
||||
: name(name)
|
||||
, age(0)
|
||||
, weight(3)
|
||||
, height(50)
|
||||
{
|
||||
}
|
||||
|
||||
char* askForName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
void gainWeight(int gain)
|
||||
{
|
||||
weight += gain;
|
||||
}
|
||||
|
||||
void grow(int gain)
|
||||
{
|
||||
height += gain;
|
||||
}
|
||||
|
||||
void celebrateBirthday()
|
||||
{
|
||||
age += 1;
|
||||
|
||||
grow(5);
|
||||
gainWeight(3);
|
||||
}
|
||||
|
||||
private:
|
||||
char* name;
|
||||
int age;
|
||||
|
||||
int height;
|
||||
int weight;
|
||||
};
|
||||
|
||||
|
||||
class Vehicle
|
||||
{
|
||||
protected:
|
||||
int wheelCount;
|
||||
int seatCount;
|
||||
};
|
||||
|
||||
class Car
|
||||
: public Vehicle
|
||||
{
|
||||
public:
|
||||
Car()
|
||||
{
|
||||
wheelCount = 4;
|
||||
seatCount = 5;
|
||||
}
|
||||
};
|
||||
|
||||
class Truck
|
||||
: public Vehicle
|
||||
{
|
||||
public:
|
||||
Truck()
|
||||
{
|
||||
wheelCount = 6;
|
||||
seatCount = 2;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<typename T>
|
||||
T sum(T a, T b)
|
||||
{
|
||||
return a + b;
|
||||
}
|
||||
|
||||
class Apple {};
|
||||
class Pear {};
|
||||
|
||||
template<typename Fruit>
|
||||
class Basket
|
||||
{
|
||||
public:
|
||||
Fruit** field;
|
||||
};
|
||||
|
||||
Basket<Apple> apples;
|
||||
Basket<Pear> pears;
|
||||
@@ -46,19 +46,19 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeFileList* parent)
|
||||
|
||||
m_minimizeButton = new QPushButton(this);
|
||||
m_minimizeButton->setObjectName("minimize_button");
|
||||
m_minimizeButton->setToolTip("minimize file");
|
||||
m_minimizeButton->setToolTip("minimize");
|
||||
m_minimizeButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
titleLayout->addWidget(m_minimizeButton);
|
||||
|
||||
m_snippetButton = new QPushButton(this);
|
||||
m_snippetButton->setObjectName("snippet_button");
|
||||
m_snippetButton->setToolTip("show snippets in file");
|
||||
m_snippetButton->setToolTip("show snippets");
|
||||
m_snippetButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
titleLayout->addWidget(m_snippetButton);
|
||||
|
||||
m_maximizeButton = new QPushButton(this);
|
||||
m_maximizeButton->setObjectName("maximize_button");
|
||||
m_maximizeButton->setToolTip("maximize file");
|
||||
m_maximizeButton->setToolTip("maximize");
|
||||
m_maximizeButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
titleLayout->addWidget(m_maximizeButton);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user