1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
<html>
<head>
<title>CamStream Tech Docs</title>
<link rel="stylesheet" href="../tech.css" type="text/css">
</head>
<body>
<h1>Programming style</h1>
<p>Because I build the program on top of Qt, some things are quite easy
to program. For example: when two views of the same video device
are open, and you change the size of one of them, the other automaticly
changes with it, including all dialogs! So how I do this? Well, with the
signal/slot mechanism it's really easy.
<p>In this case there is a single common item: the video device. So it makes
sense for this device to announce to the world that something has changed,
and that is just what the <span class="code">CVideoDevice::Resized()</span>
signal is for: when the size has been changed by a call to <span
class="code">CVideoDevice::SetSize()</span>, this signal will be called. All
viewers and dialogs connect to this slot, and thus get notified of any
changes.
<p>The Qt library automatically cleans up connections to objects that
are deleted, so you don't no need to worry about that.
</body>
</html>
|