Skip to content
  • 0 Votes
    5 Posts
    815 Views
    N

    And no comes a reply to myself !

    We figured out how to hack towards the behaviour we need.

    1/ we add an ObjectiveC .mm file to the project, to call somme MacOS Cocoa's stuff

    2/ At application AppB startup, from this ObjectiveC file we call

    [NSApp hide:nil]

    which "hides" the application, and reactivate our AppA.

    Well... This turns into some flickering of the active application (because AppA looses for a few ms activation when AppB starts ; then AppB hides itself and AppA gets the active app again), but we can live with that !

    Thanks

  • 0 Votes
    5 Posts
    310 Views
    T

    Thank you all ! I think @JonB 's suggestion will do the job since my goal is more comprehensive.

  • 0 Votes
    6 Posts
    696 Views
    JoeCFDJ

    @Saviz

    #include <QApplication> #include <QMouseEvent> #include <QVideoWidget> class HoverVideoWidget : public QVideoWidget { public: HoverVideoWidget(QWidget *parent = nullptr) : QVideoWidget(parent) { setMouseTracking(true); // Enable mouse tracking to get hover events } protected: void enterEvent(QEvent *event) override { // Called when the mouse enters the widget setStyleSheet("background-color: lightblue;"); // Set the background color to light blue } void leaveEvent(QEvent *event) override { // Called when the mouse leaves the widget setStyleSheet(""); // Reset the background color to default } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); HoverVideoWidget player; player.show(); return app.exec(); }
  • 1 Votes
    1 Posts
    841 Views
    No one has replied
  • 0 Votes
    6 Posts
    1k Views
    M

    Okay proxy and listView is what solved the problem for me, thanks @SGaist and @Christian-Ehrlicher. I made a QListView and filtered it with the input of a QLineEdit and a sortFilterProxy, then I toke the data of the sortFilter and inserted it into a QTableView and cleaned the presentation with a delegate up. It works fast and snappy with my 20 exmaple data, I just hope that it keeps working as good with my ~300 data, but to get to this tests I have to finish other parts of my project first. I call this solved for now :-)

  • 0 Votes
    10 Posts
    5k Views
    F

    @jsulm I tried. But it cannot be closed as there is nothing to close ( there is no dialog/application in the first place). Haha. its alright. I will continue to explore and see if there is any other way.

  • 0 Votes
    4 Posts
    1k Views
    jsulmJ

    @Lasith Why is your main window a dialog? How do you show main window? If you use exec() then it is a modal window.

  • 0 Votes
    4 Posts
    6k Views
    raven-worxR

    @HenrikSt.
    in your Kobi class, add a setter method:

    class Kobi : public ... { public: ... void setButtonWidget( QPushButton* button ) { m_PushButton = button; } void Kobi::FullScreen () { tableWidget->hide (); // OR EMIT A SIGNAL HERE AND CONNECT IT TO THE PUSHBUTTON'S hide() SLOT if( m_PushButton ) m_PushButton->hide(); } private: QPointer<QPushButton*> m_PushButton; }

    Easiest would be when you could already create the button in this class?

  • 0 Votes
    9 Posts
    4k Views
    McLionM

    I now have an eventfilter on every of my (16) webView.
    I added some debug on the MyApp notify and in the new eventfilter.
    I can see that myApp gets every keypress (first) and the installed eventfilter on the webView's gets the keypress only if any of the webView is shown.

    I'm not sure how to proceed or how this helps in forwarding the event to a specific webView since the event is not getting to the eventfilter if a webView is not active.

    How about catching the event in MyApp notify and somehow posting it to a specific webView?

    Thanks for your help.

  • 0 Votes
    4 Posts
    5k Views
    DongD

    Finally, I made it !!!

    1. To implement "Drop Down List" just like Normal Combo

    "Drop Down List" need to be on top of all other control "Drop Down List" must be disappear when click outside it

    To do that, I need to set the "Root Item" (ApplicationWindow or other Component) as parent of maskMouseArea & recDropDown
    (There is a little tricky here and I write a javascript function to return the "Root Item" & "Referred Coordinate" to the Combo - You need this to display the popup by set x, y position)

    function getRootComponent(component) { var result = {Component : component, refX : 0, refY : 0 } while (result.Component.parent) { result.refX = result.refX + result.Component.x result.refY = result.refY + result.Component.y result.Component = result.Component.parent } return result; }

    When user Click on maskMouseArea it'll close the recDropDown

    Bellow is source code of MyComboBox.qml

    (Note CommonScript.jsBinding is my function to support binding with Dynamic Property, you can use normal binding)

    import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Styles 1.2 import "../" import "../commonScripts.js" as CommonScript Rectangle { id: root width: 160 height: MDStyle.comboBoxHeight border.width: 1 border.color: MDStyle.borderColor color: MDStyle.backGroundColor radius: 2 clip: true signal activated(int index) property int currentIndex: -1 property var selectedValue property var selectedItem property string displayMember: "Text" property string valueMember: "Value" property string imageSourceMember: "ImageSource" property bool showIcon: false property int dropDownMinWidth: root.width property int dropDownMaxWidth: 2 * dropDownMinWidth property int maxRowsCount: 6 property var model property bool popupVisible : false property int rowHeight : 28 property string displayText: "" Item { id: privateProperties property var rootAncestor: CommonScript.getRootComponent(root) property int popupWidth : root.dropDownMinWidth property bool popupWidthAutoAdjusted: false } property Component displayItem: Label { id : lblDisplayText anchors.left: parent.left anchors.leftMargin: MDStyle.textFontSize / 2 anchors.right: parent.right anchors.rightMargin: recArrowContainer.width + 2 anchors.verticalCenter: parent.verticalCenter font.family: MDStyle.fontFamily font.pixelSize: MDStyle.textFontSize color: MDStyle.fontColor clip: true text: displayText != "" ? displayText : listItems.selectedIndex >= 0 ? listItems.model[listItems.selectedIndex].binding(displayMember) : "" } Rectangle { id: recControlHover anchors.fill: parent anchors.margins: 2 border.width: 0 color: "#113399FF" visible: clickableArea.containsMouse } //MouseArea to show popup when clicked MouseArea { id: clickableArea anchors.fill: parent hoverEnabled: true onClicked: { root.popupVisible = true return true; } } //Loader for Display Item Loader { id : displayItemLoader anchors.left: parent.left anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter sourceComponent: displayItem } //Arrow Image Rectangle { id: recArrowContainer height: parent.height - 2 * anchors.margins width: height - 2 * anchors.margins anchors.top: parent.top anchors.right: parent.right anchors.margins: 1 radius: 2 color: "transparent" Image { id: imgArrow anchors.centerIn: parent width: sourceSize.width height: sourceSize.height source: "qrc:/Images/GUI/metrixa-icon-down-arrow.png" } } //Mask Mouse Area (used to hide Drop Down List when click outside Drop Down List) MouseArea { id: maskMouseArea parent: privateProperties.rootAncestor.Component anchors.fill: parent visible: root.popupVisible onClicked: { root.popupVisible = false return false } z: 9998 } //Drop Down List Rectangle { id: recDropDown parent: privateProperties.rootAncestor.Component width: { return CommonScript.max(root.width, privateProperties.popupWidth + listItems.anchors.leftMargin + listItems.anchors.rightMargin + ddlScrollView.anchors.leftMargin + ddlScrollView.anchors.rightMargin) } height: root.rowHeight * CommonScript.min(root.maxRowsCount, (root.model ? root.model.length : 0)) + ddlScrollView.anchors.topMargin + ddlScrollView.anchors.bottomMargin + listItems.anchors.topMargin + listItems.anchors.bottomMargin clip: true radius:2 x: privateProperties.rootAncestor.refX y: privateProperties.rootAncestor.refY + root.height + 1 border.width: 1 border.color: MDStyle.borderColor color: "#FFFFFF" visible: root.popupVisible z: 9999 ScrollView { id: ddlScrollView anchors.fill: parent anchors.margins: 1 clip: true ListView { id: listItems anchors.left : parent.left anchors.right : parent.right anchors.top : parent.top orientation: Qt.Vertical anchors.margins: 2 height: { //Only count displayed items var visibleItemsCount = 0 for (var i = 0; i < listItems.model.length; i++) { var isVisible = true; if (listItems.model[i].binding("Visible") !== undefined) visible = listItems.model[i].binding("Visible"); if (isVisible) visibleItemsCount = visibleItemsCount + 1 } return CommonScript.min(maxRowsCount, visibleItemsCount) * root.rowHeight } property int selectedIndex: -1 model: root.model delegate: Rectangle { id: recItemContainer width: parent.width height: bVisible ? root.rowHeight : 0 clip: true property var itemModel: model property bool bVisible: CommonScript.jsBinding(recItemContainer, "bVisible", model ? model.modelData : undefined, "Visible", true) property bool bEnable: CommonScript.jsBinding(recItemContainer, "bEnable", model ? model.modelData : undefined, "Enable", true) property bool isHovered: false Rectangle { id: recHilight color: "#663399FF" anchors.fill: parent anchors.margins: 0 radius: 2 visible: index === listItems.selectedIndex } Rectangle { id: recDisabled color: "#666666" anchors.fill: parent anchors.margins: 0 radius: 2 visible: false //!recItemContainer.bEnable } Rectangle { id: recItemHover color: "#333399FF" anchors.fill: parent anchors.margins: 1 radius: 2 visible: itemMouseArea.containsMouse } Loader { id: listItemLoader sourceComponent: listItem //anchors.fill: parent property var model: recItemContainer.itemModel onLoaded: { adjustPopupWidth(); } function adjustPopupWidth() { var pWidth = CommonScript.max(listItemLoader.item.width, root.dropDownMinWidth) if (pWidth > privateProperties.popupWidth) privateProperties.popupWidthAutoAdjusted = true pWidth = CommonScript.max(pWidth, privateProperties.popupWidth) pWidth = CommonScript.min(pWidth, root.dropDownMaxWidth) root.rowHeight = CommonScript.max(listItemLoader.item.height, root.rowHeight) privateProperties.popupWidth = pWidth if (listItemLoader.width == 0) listItemLoader.width = pWidth } } MouseArea { id: itemMouseArea anchors.fill: parent enabled: recItemContainer.bEnable hoverEnabled: true onClicked: { if (recItemContainer.bEnable) { if (listItems.selectedIndex != index) { listItems.selectedIndex = index listItems.updateSelection() activated(index) } root.popupVisible = false } return true } } } onCurrentIndexChanged: { updateSelection() } function updateSelection () { displayText = "" root.currentIndex = listItems.selectedIndex root.selectedValue = listItems.model[listItems.selectedIndex].binding(root.valueMember) root.selectedItem = listItems.model[listItems.selectedIndex] } } } } property Component listItem: Rectangle { width: recImage.width + lblItemText.contentWidth + 2 * lblItemText.anchors.leftMargin height: MDStyle.textBoxHeight Rectangle { id: recImage width: parent.height height: parent.height anchors.top: parent.top anchors.left: parent.left color: "transparent" visible: root.showIcon Image { id: imgItemIcon width: sourceSize.width height: sourceSize.height anchors.centerIn: parent source: CommonScript.jsBinding(imgItemIcon, "source", model ? model.modelData : undefined, imageSourceMember, "") } } Label { id: lblItemText anchors.left: root.showIcon ? recImage.right : parent.left anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter anchors.leftMargin: font.pixelSize / 2 font.family: MDStyle.fontFamily font.pixelSize: MDStyle.textFontSize property bool bEnable: CommonScript.jsBinding(lblItemText, "bEnable", model ? model.modelData : undefined, "Enable", true) color: bEnable ? MDStyle.fontColor : MDStyle.fontColorDisable clip: true text: CommonScript.jsBinding(lblItemText, "text", model ? model.modelData : undefined, displayMember, "") } } onCurrentIndexChanged: { if (listItems.selectedIndex != currentIndex) listItems.selectedIndex = currentIndex } onSelectedValueChanged: { updateCurrentIndex() } onModelChanged: { updateCurrentIndex() } function updateCurrentIndex() { if (!selectedValue) { displayText = CommonScript.VariesText } else if (selectedValue === undefined) { console.log("Selected Value is undefined") } else { console.log("Selected Value: " + selectedValue) } displayText = "" if (root.currentIndex >= 0) { if (model[root.currentIndex].binding(valueMember) === selectedValue) return; } for (var i = 0; i < model.length; i++) { if (model[i].binding(valueMember) === selectedValue) { root.currentIndex = i; return; } } } }
  • 0 Votes
    2 Posts
    20k Views
    TheBadgerT

    A layout can not be hidden since they are not widgets and does not have a setVisible() function.

    You have to create a widget that you can hide, that contains the layout and the other widgets that should be hidden, then you hide the widget instead of the layout.

    QWidget* myWidget = new QWidget(); QHBoxLayout * layout = new QHBoxLayout(myWidget); layout->addWidget(new QLabel("Label")); myWidget->setVisible(false);
  • 0 Votes
    8 Posts
    4k Views
    SGaistS

    You're welcome !

    As for marking the thread as solved, you can now use the "Topic Tool" button, it will keep the title clean.

    Also, while browsing the forum, please consider up-voting answers that helped you, that will make them easier to find for other forum users :)

  • 0 Votes
    2 Posts
    2k Views
    jsulmJ

    From the documentation for placeholderText : QString:
    "This property holds the line edit's placeholder text.
    Setting this property makes the line edit display a grayed-out placeholder text as long as the line edit is empty."
    So, setting the text means the place holder text isn't shown any more.
    You can check whether the value is empty before you use it. If it is empty you use your default value.

  • 0 Votes
    4 Posts
    8k Views
    K

    Yes, that is the way it should work.

    You can hide also anything based on QWidget Sometimes you have more than one possibility. So there is also some redundancy.

  • 0 Votes
    4 Posts
    4k Views
    Z

    これで行けました。

    function Controller()
    {

    }

    Controller.prototype.FinishedPageCallback = function()
    {
    buttons.CommitButton.hide();
    }