Module: Qt
- Defined in:
- lib/Qt/qtruby4.rb,
lib/Qt4.rb,
lib/qttest/qttest.rb,
ext/ruby/qttest/qttest.rb
Overview
/***************************************************************************
qtruby.rb - description
-------------------
begin : Fri Jul 4 2003
copyright : (C) 2003-2008 by Richard Dale
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
***************************************************************************/
Defined Under Namespace
Modules: DebugLevel, Internal, QtDebugChannel Classes: AbstractSlider, AbstractSocket, AbstractTextDocumentLayout, AccessibleEvent, Action, ActionEvent, Application, Base, BlockInvocation, Boolean, Buffer, ButtonGroup, ByteArray, CheckBox, ChildEvent, CloseEvent, Color, Connection, ContextMenuEvent, CoreApplication, Cursor, CustomEvent, DBusArgument, DBusConnection, DBusConnectionInterface, DBusError, DBusInterface, DBusMessage, DBusReply, DBusVariant, Date, DateTime, Dial, Dialog, Dir, DomAttr, DomDocumentType, DoubleSpinBox, DoubleValidator, DragEnterEvent, DragLeaveEvent, DropEvent, Enum, Event, EventLoop, File, FileIconProvider, FileOpenEvent, FocusEvent, Font, FontDatabase, Ftp, GLContext, GLPixelBuffer, GLWidget, GenericArgument, Gradient, GraphicsEllipseItem, GraphicsItem, GraphicsItemGroup, GraphicsLineItem, GraphicsPathItem, GraphicsPixmapItem, GraphicsPolygonItem, GraphicsProxyWidget, GraphicsRectItem, GraphicsSceneContextMenuEvent, GraphicsSceneDragDropEvent, GraphicsSceneHelpEvent, GraphicsSceneHoverEvent, GraphicsSceneMouseEvent, GraphicsSceneWheelEvent, GraphicsSimpleTextItem, GraphicsSvgItem, GraphicsTextItem, GraphicsWidget, HelpEvent, HideEvent, HoverEvent, Http, HttpRequestHeader, IODevice, IconDragEvent, Image, ImageIOHandler, ImageReader, ImageWriter, InputEvent, InputMethodEvent, IntValidator, Integer, ItemSelection, ItemSelectionModel, KeyEvent, KeySequence, LCDNumber, Library, Line, LineF, ListWidgetItem, Locale, Menu, MetaClassInfo, MetaEnum, MetaInfo, MetaMethod, MetaObject, MetaProperty, MetaType, MethodInvocation, ModelIndex, MouseEvent, MoveEvent, Movie, NetworkProxy, Object, PageSetupDialog, PaintEvent, Picture, PictureIO, Pixmap, PluginLoader, Point, PointF, Polygon, PolygonF, PrintDialog, Printer, Process, ProgressBar, ProgressDialog, PushButton, QObjectMember, RadioButton, Rect, RectF, Region, ResizeEvent, RubyThreadFix, ScrollBar, Shortcut, ShortcutEvent, ShowEvent, SignalBlockInvocation, Size, SizeF, SizePolicy, Slider, SocketNotifier, SpinBox, SqlDatabase, SqlError, SqlField, SqlIndex, SqlQuery, SqlResult, SqlTableModel, StandardItem, StandardItemModel, StatusTipEvent, StyleHintReturn, StyleOption, SyntaxHighlighter, TableWidgetItem, TemporaryFile, Test, TextCursor, TextDocument, TextFormat, TextImageFormat, TextInlineObject, TextLength, TextList, TextObject, TextTable, TextTableCell, Time, TimeLine, Timer, TimerEvent, ToolButton, Translator, TreeWidget, TreeWidgetItem, TreeWidgetItemIterator, Url, UrlInfo, Uuid, Variant, WMatrix, WhatsThisClickedEvent, Widget, WindowStateChangeEvent, XmlAttributes
Constant Summary collapse
- Meta =
Qt::Internal
{}
- WidgetType =
These values are from the enum WindowType in qnamespace.h. Some of the names such as ‘Qt::Dialog’, clash with QtRuby class names. So add some constants here to use instead, renamed with an ending of ‘Type’.
0x00000000
- WindowType =
0x00000001
- DialogType =
0x00000002 | WindowType
- SheetType =
0x00000004 | WindowType
- DrawerType =
0x00000006 | WindowType
- PopupType =
0x00000008 | WindowType
- ToolType =
0x0000000a | WindowType
- ToolTipType =
0x0000000c | WindowType
- SplashScreenType =
0x0000000e | WindowType
- DesktopType =
0x00000010 | WindowType
- SubWindowType =
0x00000012
- @@debug_level =
DebugLevel::Off
Class Method Summary collapse
- .debug_level ⇒ Object
- .debug_level=(level) ⇒ Object
-
.execute_in_main_thread(blocking = true, sleep_period = 0.001, delay_execution = false) ⇒ Object
Code which accesses the GUI must be executed in the main QT GUI thread.
Class Method Details
.debug_level ⇒ Object
43 44 45 |
# File 'lib/Qt/qtruby4.rb', line 43 def Qt.debug_level @@debug_level end |
.debug_level=(level) ⇒ Object
38 39 40 41 |
# File 'lib/Qt/qtruby4.rb', line 38 def Qt.debug_level=(level) @@debug_level = level Internal::setDebug Qt::QtDebugChannel::QTDB_ALL if level >= DebugLevel::Extensive end |
.execute_in_main_thread(blocking = true, sleep_period = 0.001, delay_execution = false) ⇒ Object
Code which accesses the GUI must be executed in the main QT GUI thread. This method allows code in another thread to execute safely in the main GUI thread. By default it will block the main GUI thread until the code in the block completes althought this can be changed by passing false for the first parameter.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/Qt4.rb', line 101 def self.execute_in_main_thread (blocking = true, sleep_period = 0.001, delay_execution = false) if Thread.current != Thread.main complete = false RubyThreadFix.queue << lambda {|| yield; complete = true} if blocking until complete sleep(sleep_period) end end else if delay_execution RubyThreadFix.queue << lambda {|| yield; complete = true} else yield end end end |