This is where the widtget is used:
@
// Lib/Qt measure example
//
// matching.cpp : Implementation of the class Matching
//
#include "matching.h"
#ifdef Q_WS_X11
#include <X11/Xlib.h>
#endif
#include <qfont.h>
#include <qlayout.h>
#include <qstring.h>
#include <qcursor.h>
// Constructor: create GUI
Matching::Matching(QWidget *parent)
: QWidget(parent)
{
WindowIDBuf = -1;
...
// Disp: Father widget for Lib window in HBoxDispAndButtons
Disp = new QLibWindow(this);
Disp->setMinimumSize(50,50);
// Buttons in HBoxDispAndButtons
QVBoxLayout *Buttons = new QVBoxLayout;
...
}
// The destructor is called when the user closes the application by clicking
// on the close button in the window manager decoration.
Matching::~Matching(void)
{
using namespace LibCpp;
// Close all allocated Lib resources.
CloseWindow(WindowIDBuf);
killTimer(Timer);
}
// Initialize Lib windows
void Matching::InitWin(void)
{
using namespace LibCpp;
// Initialize framegrabber
InitFg();
WindowWidth = Disp->width();
WindowHeight = Disp->height();
// Open a Lib buffer window that will be used to program a flicker-free
// display of the results.
OpenWindow(0,0,WindowWidth,WindowHeight,0,"buffer","",&WindowIDBuf);
SetPart(Disp->WindowID(),0,0,Height-1,Width-1);
SetPart(WindowIDBuf,0,0,Height-1,Width-1);
SetLineWidth(Disp->WindowID(),3);
SetLineWidth(WindowIDBuf,3);
DispObj(Image,Disp->WindowID());
}
// This slot is called whenever the application's main widget is resized.
// The member function QLibWindow::resizeEvent() of the QLibWindow
// widget is called before this function, thus only the buffer window needs
// to be resized at this point.
void Matching::resizeEvent(QResizeEvent*)
{
using namespace LibCpp;
if (WindowIDBuf>0)
{
// Determine the new dimensions of the QLibWindow widget.
// We save the new dimensions for later use in CopyRectangle.
WindowWidth = Disp->width();
WindowHeight = Disp->height();
SetWindowExtents(WindowIDBuf,0,0,WindowWidth,WindowHeight);
// Display the current image. Note that this will slow down the resize
// operation considerably.
DispObj(Image,Disp->WindowID());
}
}
// This function is called continously after Timer is started in ::Start()
void Matching::timerEvent(QTimerEvent*)
{
StartMatching();
}
// Start continuous matching
void Matching::Start(void)
{
StartButton->setEnabled(false);
StopButton->setEnabled(true);
// Start Timer -> ::timerEvent() is called continously
Timer = startTimer(20);
}
// Stop continuous matching
void Matching::Stop(void)
{
StartButton->setEnabled(true);
StopButton->setEnabled(false);
// Kill Timer
killTimer(Timer);
}
@