本文整理汇总了Python中PyQt4.QtDeclarative.QDeclarativeView类的典型用法代码示例。如果您正苦于以下问题:Python QDeclarativeView类的具体用法?Python QDeclarativeView怎么用?Python QDeclarativeView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDeclarativeView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main():
# Main function to be executed while running the program
# Generate QML View
app = QApplication(sys.argv)
view = QDeclarativeView()
view.setSource(QUrl('Fingers.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
# Get Root Object for communication
global rootObject
rootObject = view.rootObject()
# Connect to start Leap signal
rootObject.qmlStarted.connect(startLeap)
# Connect to stop Leap signal
rootObject.qmlStop.connect(stopLeap)
# Display the component
import subprocess
output = subprocess.Popen('xrandr | grep "\*" | cut -d" " -f4',shell=True, stdout=subprocess.PIPE).communicate()[0]
output = output[:-1]
screenX = output[:output.index('x')]
screenY = output[output.index('x')+1:]
view.setGeometry(100, 100, int(screenX), int(screenY))
view.show()
app.exec_()
示例2: create_dv
def create_dv():
# Create the QML user interface.
view = QDeclarativeView()
view.setSource(QUrl('qml/leonbmain.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
# Display the user interface and allow the user to interact with it.
view.setGeometry(100, 100, 400, 240)
view.show()
rootObject = view.rootObject()
return view
示例3: __init__
def __init__(self):
super(Notification, self).__init__()
self.setAttribute(Qt.WA_TranslucentBackground)
self.setStyleSheet("background:transparent;")
self.setWindowFlags(Qt.FramelessWindowHint)
self.setMinimumHeight(120)
# Create the QML user interface.
view = QDeclarativeView()
view.setSource(QUrl('Bubble.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
vbox = QVBoxLayout(self)
vbox.addWidget(view)
示例4: __init__
def __init__(self, parent=None):
super(StartPage, self).__init__(parent)
self._id = "Start Page"
vbox = QVBoxLayout(self)
self.view = QDeclarativeView()
self.view.setMinimumWidth(430)
#self.view.setMinimumWidth(400)
#self.view.setMinimumHeight(500)
self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
path_qml = QDir.fromNativeSeparators(
os.path.join(resources.QML_FILES, "StartPage_Alexa.qml"))
#os.path.join(resources.QML_FILES, "StartPage.qml"))
path_qml = urlunparse(urlparse(path_qml)._replace(scheme='file'))
self.view.setSource(QUrl(path_qml))
self.root = self.view.rootObject()
vbox.addWidget(self.view)
self.load_items()
self.connect(self.root, SIGNAL("openProject(QString)"),
self._open_project)
self.connect(self.root, SIGNAL("removeProject(QString)"),
self._on_click_on_delete)
self.connect(self.root, SIGNAL("markAsFavorite(QString, bool)"),
self._on_click_on_favorite)
self.connect(self.root, SIGNAL("openPreferences()"),
lambda: self.emit(SIGNAL("openPreferences()")))
示例5: __init__
def __init__(self, parent=None):
super(FilesHandler, self).__init__(
None, Qt.FramelessWindowHint | Qt.Popup)
self._main_container = parent
self.setAttribute(Qt.WA_TranslucentBackground)
self.setStyleSheet("background:transparent;")
# Create the QML user interface.
self.view = QDeclarativeView()
self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
self.view.setSource(ui_tools.get_qml_resource("FilesHandler.qml"))
self._root = self.view.rootObject()
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
vbox.addWidget(self.view)
self._model = {}
self._temp_files = {}
self._max_index = 0
self.connect(self._root, SIGNAL("open(QString, QString, QString)"),
self._open)
self.connect(self._root, SIGNAL("close(QString, QString)"), self._close)
self.connect(self._root, SIGNAL("hide()"), self.hide)
self.connect(self._root, SIGNAL("fuzzySearch(QString)"),
self._fuzzy_search)
示例6: __init__
def __init__(self, parent=None):
super(StartPage, self).__init__(parent)
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
self.view = QDeclarativeView()
self.view.setMinimumWidth(400)
self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
self.view.setSource(ui_tools.get_qml_resource("StartPage.qml"))
self.root = self.view.rootObject()
vbox.addWidget(self.view)
self.load_items()
self.connect(self.root, SIGNAL("openProject(QString)"),
self._open_project)
self.connect(self.root, SIGNAL("removeProject(QString)"),
self._on_click_on_delete)
self.connect(self.root, SIGNAL("markAsFavorite(QString, bool)"),
self._on_click_on_favorite)
self.connect(self.root, SIGNAL("openPreferences()"),
lambda: self.emit(SIGNAL("openPreferences()")))
self.connect(self.root, SIGNAL("newFile()"),
lambda: self.emit(SIGNAL("newFile()")))
self.root.set_year(str(datetime.datetime.now().year))
示例7: __init__
def __init__(self):
QWidget.__init__(self)
box = QVBoxLayout(self)
box.setContentsMargins(0, 0, 0, 0)
view = QDeclarativeView()
view.setMinimumSize(400, 400)
view.setSource(QUrl("src/ui/StartPage.qml"))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
box.addWidget(view)
示例8: __init__
def __init__(self, parent=None):
super(PluginsStore, self).__init__(parent, Qt.Dialog)
self.setWindowTitle(translations.TR_MANAGE_PLUGINS)
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
self.view = QDeclarativeView()
self.view.setMinimumWidth(800)
self.view.setMinimumHeight(600)
self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
self.view.setSource(ui_tools.get_qml_resource("PluginsStore.qml"))
self.root = self.view.rootObject()
vbox.addWidget(self.view)
self._plugins = {}
self._plugins_inflate = []
self._plugins_by_tag = collections.defaultdict(list)
self._plugins_by_author = collections.defaultdict(list)
self._base_color = QColor("white")
self._counter = 0
self._counter_callback = None
self._inflating_plugins = []
self._categoryTags = True
self._search = []
self.status = None
self.connect(self.root, SIGNAL("loadPluginsGrid()"),
self._load_by_name)
self.connect(self.root, SIGNAL("close()"),
self.close)
self.connect(self.root, SIGNAL("showPluginDetails(int)"),
self.show_plugin_details)
self.connect(self.root, SIGNAL("loadTagsGrid()"),
self._load_tags_grid)
self.connect(self.root, SIGNAL("loadAuthorGrid()"),
self._load_author_grid)
self.connect(self.root, SIGNAL("search(QString)"),
self._load_search_results)
self.connect(self.root, SIGNAL("loadPluginsForCategory(QString)"),
self._load_plugins_for_category)
self.connect(self, SIGNAL("processCompleted(PyQt_PyObject)"),
self._process_complete)
self.nenv = nenvironment.NenvEggSearcher()
self.connect(self.nenv,
SIGNAL("searchCompleted(PyQt_PyObject)"),
self.callback)
self.status = self.nenv.do_search()
示例9: __init__
def __init__(self):
super(StartPage, self).__init__()
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
view = QDeclarativeView()
qml = os.path.join(os.path.dirname(__file__), "StartPage.qml")
path = QDir.fromNativeSeparators(qml)
view.setSource(QUrl.fromLocalFile(path))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
self._root = view.rootObject()
vbox.addWidget(view)
示例10: __init__
def __init__(self, parent=None):
super(PluginsStore, self).__init__(parent, Qt.Dialog)
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
self.view = QDeclarativeView()
self.view.setMinimumWidth(800)
self.view.setMinimumHeight(600)
self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
self.view.setSource(ui_tools.get_qml_resource("PluginsStore.qml"))
self.root = self.view.rootObject()
vbox.addWidget(self.view)
self.nenv = nenvironment.NenvEggSearcher()
self.connect(self.nenv, SIGNAL("searchCompleted(PyQt_PyObject)"),
self.callback)
self.status = self.nenv.do_search()
示例11: __init__
def __init__(self):
QWidget.__init__(self)
box = QVBoxLayout(self)
box.setContentsMargins(0, 0, 0, 0)
view = QDeclarativeView()
view.setMinimumSize(400, 400)
qml = os.path.join(paths.PATH, "ui", "StartPage.qml")
path = QDir.fromNativeSeparators(qml)
view.setSource(QUrl.fromLocalFile(path))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
self._root = view.rootObject()
box.addWidget(view)
self._current_text = ""
# Timer
self.timer = QTimer(self)
self.timer.setInterval(3000)
self._show_welcome_text()
self.timer.timeout.connect(self._show_text)
self.timer.start()
示例12: __init__
def __init__(self, schedule_dir):
self.schedule_dir = schedule_dir
self.videos = {}
self.playlist = []
self.app = QApplication(sys.argv)
self.view = QDeclarativeView()
self.view.setSource(QUrl('scene.qml'))
self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
self.viewRoot = self.view.rootObject()
self.viewRoot.quit.connect(self.app.quit)
self.viewRoot.finished.connect(self.show_next)
self.view.setGeometry(100, 100, 400, 240)
self.view.showFullScreen()
self.watcher = QFileSystemWatcher()
示例13: __init__
def __init__(self, parent=None):
super(SplitOrientation, self).__init__(parent,
Qt.Dialog | Qt.FramelessWindowHint)
self.setModal(True)
self.setAttribute(Qt.WA_TranslucentBackground)
self.setStyleSheet("background:transparent;")
self.setFixedHeight(150)
self.setFixedWidth(310)
# Create the QML user interface.
view = QDeclarativeView()
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
view.setSource(ui_tools.get_qml_resource("SplitOrientation.qml"))
self._root = view.rootObject()
vbox = QVBoxLayout(self)
vbox.addWidget(view)
示例14: __init__
def __init__(self, parent=None):
super(MainSelector, self).__init__(parent)
# Create the QML user interface.
view = QDeclarativeView()
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
view.setSource(ui_tools.get_qml_resource("MainSelector.qml"))
self._root = view.rootObject()
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
vbox.addWidget(view)
self.connect(self._root, SIGNAL("open(int)"),
lambda i: self.emit(SIGNAL("changeCurrent(int)"), i))
self.connect(self._root, SIGNAL("ready()"),
lambda: self.emit(SIGNAL("ready()")))
示例15: __init__
def __init__(self, parent=None):
super(AddFileFolderWidget, self).__init__(
parent, Qt.Dialog | Qt.FramelessWindowHint)
self._main_container = parent
self.setModal(True)
self.setAttribute(Qt.WA_TranslucentBackground)
self.setStyleSheet("background:transparent;")
self.setFixedHeight(70)
self.setFixedWidth(650)
# Create the QML user interface.
self.view = QDeclarativeView()
self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
self.view.setSource(ui_tools.get_qml_resource("AddFileFolder.qml"))
self._root = self.view.rootObject()
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
vbox.setSpacing(0)
vbox.addWidget(self.view)
self._base_path = ""
self._create_file_operation = True
self.connect(self._root, SIGNAL("create(QString)"), self._create)